Part Number Hot Search : 
DC12V 30001 CSDA1AA 24000 DG418 MAX1535A CXOSNSM5 1N5069
Product Description
Full Text Search
 

To Download ST6373 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  february 1998 1/64 this is advance information from sgs-thoms on. details are subject to change withoutnotice. r ST6373 8-bit rom/otp/eprom mcus for digitally controlled multisync/multistandard monitors n 4.5v to 6v operating supply voltage range n low current consumption n 0to+70 c operating temperature range n 8 mhz clock oscillator n 16k bytes rom/otp/eprom (8k and 12k rom versions also available) n 192 bytes ram n 384 bytes general purpose eeprom n 128 bytes dedicated eeprom for ddc spi n 22 fully programmable i/o pins, offering direct led drive capability, as well as interrupt generation for keyboard inputs n digital watchdog timer n three timers, each comprising an 8-bit counter and a 7- bit prescaler n sync processor: 12-bits hsync event counter 12-bits vsync period counter hsync and vsync polarity detection hsync and vsync outputs hflyback and vflyback inputs clamp and blank outputs n 14-bit (pwm + brm) d/a converter n nine 7-bit pwm d/a converter outputs n 8-bit a/d converter with 8 multiplexed inputs n ddc spi with interrupt and 4 operating modes n a further spi with interrupt and 2 operating modes n remote control signal input (non maskable interrupt) n vsync interrupt input n five interrupt vectors n xor register (instruction set expansion) n mirror register (instruction set expansion) psdip42 csdip42 (refer to end of document for ordering information) 1
table of contents 64 2/64 ST6373 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 1 general description . . ....................................................4 1.1 introduction . . . . . . . ..................................................4 1.2 pin description . . . . . . . ................................................6 1.3 memory spaces .......................................................8 1.3.1 stack space . . . . . . . . . . . .............................................8 1.3.2 program space . . . . . ................................................8 1.3.3 data space .......................................................10 1.3.4 data ram/eeprom ................................................12 1.3.5 eeprom description . . . . . . . . . . . . . ..................................12 1.4 memoryprogramming ...............................................15 1.4.1 program memory . . . . . . . . . ..........................................15 1.4.2 option byte .......................................................15 1.4.3 eprom erasure . . . . . . . ..............................................15 2 central processing unit . . . ..............................................16 2.1 introduction . . . . . . . .................................................16 2.2 cpu registers .......................................................16 3 clocks, reset, interrupts and power saving modes .....................18 3.1 on-chip clock oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . ................18 3.2 resets...............................................................19 3.2.1 reset input . . . . . . . ...............................................19 3.2.2 power-on reset . . . . . . . . . . . . . . . .....................................19 3.2.3 watchdog reset . ..................................................20 3.2.4 application note . . . . . . . . . . . . . . . .....................................20 3.2.5 mcu initialization sequence ..........................................20 3.3 hardware activated digital watchdog function . . . . . ...............21 3.4 interrupt . . . . . . . . . . . . . . . . . . . .........................................23 3.4.1 interrupt vectors/sources . ...........................................23 3.4.2 interrupt priority . . . . . . . . . . . . . . . .....................................24 3.4.3 interrupt option register . . . . . . . . . . . . . . . . . . . . . ........................24 3.4.4 interrupt procedure .................................................25 3.4.5 ST6373 interrupt details . . . . . . . . . . . . . . . . . . . . . ........................25 3.5 power saving modes . . . ..............................................28 3.5.1 wait mode .......................................................28 3.5.2 stop mode . . . . . . . . . . . ............................................28 3.5.3 exit from wait mode . . . . . . . .........................................28 4 on-chip peripherals ......................................................29 4.1 i/oports.............................................................29 4.1.1 details of i/o ports a and b . . . . . . . . . . . . . . . . . . .........................30 4.1.2 details of i/o port c . . . ..............................................31 4.1.3 i/o port registers ..................................................34 4.2 timers ...............................................................35 4.2.1 timer operating modes . . . . ..........................................36 4.2.2 timer status control registers (tscr). . . ...............................37 4.2.3 timer counter registers (tcr) . . . . . . . . . . . . . . . . . . . .....................37
table of contents 3/64 1 4.2.4 timer prescaler registers (psc) . . .....................................37 4.3 a/d converter (adc) . . . . . . . . ..........................................38 4.3.1 application notes . . . . . . . . . ..........................................38 4.4 sync processor . . . . . . . ..............................................40 4.4.1 event counter . . ...................................................40 4.4.2 period counter . . . . . . . ..............................................40 4.4.3 polarity detector . ..................................................40 4.4.4 output polarity control ...............................................40 4.4.5 video blanking generator . ...........................................41 4.5 14-bit pwm d/a converter . ...........................................44 4.5.1 output details . . ...................................................44 4.5.2 hda tuning cell registers ...........................................44 4.6 7-bit pwm d/a converters . ...........................................45 4.6.1 digital outputs . . . . . . . ..............................................45 4.7 serial peripheral interfaces . . . . . . . . . . . . . . . . . . . .....................46 4.7.1 spi modes ........................................................47 4.8 mirror register . . . . . . . ..............................................51 4.9 xor register . . . . . . . .................................................51 5 software . . . . . . . . . .......................................................52 5.1 st6 architecture . . . . . . . . . . . . . . . .....................................52 5.2 addressing modes . . . . . . . . . ..........................................52 5.3 instruction set ......................................................53 6 electrical characteristics . . . . ..........................................58 6.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . .........................58 6.2 recommended operating conditions. . . . .............................58 6.3 dc electrical characteristics . . ....................................59 6.4 ac electrical characteristics . . ....................................60 7 general information . . . . . . . ..............................................61 7.1 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . ................61 7.2 ordering information . . . . . . . . . . . . . ..................................62
ST6373 4/64 1 general description 1.1 introduction ST6373 microcontrollers are members of the 8-bit hcmos st637x family, a series of devices spe- cially intended for digitally controlled multi fre- quency monitor applications. all st637x devices are based on a building block approach: a com- mon core is surrounded by a combination of on- chip peripherals (macrocells) available from a standard library. ST6373 devices are available in functionally iden- tical rom, otp (st63t73) and eprom (st63e73) versions, all with the same pinout. rom devices are available with 8, 12 or 16k pro- gram memory, whereas otp and eprom ver- sions are both available in 16k versions only. for details relating to sales types, refer to section 7.2. since rom, otp and eprom versions are functionally identical, the present datasheet will refer to the generic ST6373 device, except where specific versions differ in detail. the ST6373 devices feature: nine pwm outputs, which can be used as digital to analog converter outputs (with external rc fil- ters). these are suitable for tuning and other functions. a pwm output with bit rate multiplier, to which the above comments apply. an event counter especially designed to calcu- late the hsync (or hdriv) frequency, using one of the on-chip timers. a period counter especially designed to calcu- late the vsync period. a polarity detector for hsync (or hdriv) and vsync. hsync and vsync outputs with controlled po- larity. video blanking and clamping outputs. two i/o ports a & b usable for a keyboard wake- up feature since an interrupt input ored on each of their pins. an analog to digital converter connected to port b which can be used to decode an analog key- board or for afc. a vsync input pin connected to an interrupt vector and to the ddc spi for ddc1 protocol. an nmi input which can be used, for example, as a remote control input for a tv application. a hardware ddc spi able to manage ddc1 (vsync as clock), ddc2b and ddc2ab (i 2 c bus multimaster and slave). a 128-byte dedicated eeprom memory is available for ddc1 and ddc2b. hardware i 2 c spi for internal monitor bus and to manage, for example, an osd. a mirror register and a xor register are includ- ed to complement the basic st6 instruction set. table 1. ST6373 device summary note: see ordering information in table 23 at the end of the datasheet. device configuration program memory (bytes) ram (bytes) eeprom (bytes) a/d inputs 14-bit d/ (pwm) output 7-bit d/a (pwm) output emulating devices ST6373 8k rom 12k rom 16k rom 192 512 8 1 9 st63e73,st63t73 st63t73 16k otp 192 512 8 1 9 - st63e73 16k eprom 192 512 8 1 9 -
ST6373 5/64 figure 1. ST6373 block diagram test nmi interrupt 16 kbytes pc stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 stack level 6 power supply oscillator reset data rom user selectable data ram 192 bytes port a port b port c 8 bit core test/v pp ( ** ) timer 1 pa0 -> pa7* v dd v ss oscin oscout reset vsync pwrin user program memory timer 2 digital watchd og/timer inputs data eeprom 384 bytes pb0 -> pb7* pc0 -> pc7* ddc spi (1) i c spi eeprom 128 bytes (1) timer 3 scld, sdad vsync, extclk scli, sdai hda, da0 -> da8 ad0 -> ad7 d/a outputs a/d inputs sync processor hsync o, vsynco hsync i, vsynci hdriv hfly, vfly clmpo, blko (*)refer to pin description for additional information ( ** )v pp input for otp/eprom device programming
ST6373 6/64 1.2 pin description v dd and v ss. power is supplied to the mcu using these two pins. v dd is power and v ss is the ground connection. oscin, oscout. these pins are internally con- nected to the on-chip oscillator circuit. a quartz crystal or a ceramic resonator can be connected between these two pins in order to allow the cor- rect operation of the mcu with various stabili- ty/cost trade-offs. the oscin pin is the input pin, the oscout pin is the output pin. reset . the active low reset pin is used to start the microcontroller to the beginning of its program. additionally the quartz crystal oscillator will be dis- abled when the reset pin is low to reduce power consumption during reset phase. test . the test pin must be held at vss for nor- mal operation. pa0, pa1, pa2/hsynco, pa3/vsynco, pa4/clmpo, pa5/blko, pa6/scli, pa7/sdai port a. software configurable as push-pull out- put, open-drain output, schmitt trigger input with or without pull-up. port a inputs can be also ored into the int1 interrupt. port a outputs have a led drive capability (10 ma). pins pa2 and pa3 can be configured respectively as hsync and vsync outputs.pins pa4 and pa5 can be configured respectively as clamp and blank outputs.pins pa6 and pa7 can be con- figurated as the i 2 c spi pins scli and sdai.the push-pull output and the input pull-up options do not exist for these two pins. after reset the pa0 to pa5 pins are configured as inputs with pull-up. pb0/ad0, pb1/ad1, pb2/ad2, pb3/ad3, pb4/ad4, pb5/ad5/hfly, pb6/ad6/vfly, pb7/ad7 port b . each pin can be software configured as push-pull output, open-drain output, schmitt trig- ger input with or without pull-up.port b inputs can be also ored into the int1 interrupt. pins pb5 and pb6 can be configured as hfly and vfly inputs. in addition, any pin of port b can be soft- ware selected as the analog-to-digital converter input. only one pin should be selected at a time, otherwise a conflict would result. after reset the port b pins are configured as inputs with pull-up. pc0/scld, pc1/sdad, pc2, pc3/extclk, pc4/pwrin, pc5, pc6/hsync, pc7/hdriv port c. software configurable as open-drain out- puts or schmitt trigger inputs with or without pull- ups. when configured as outputs, pins pc0 to pc3 are configured as 5v open-drain. pins pc4 to pc7 are configured as open-drain 12v; the in- put pull-up option does not exist for these four pins. pins pc0, pc1 and pc3 can be configured as the ddc spi pins scld, sdad and extclk. the input pull-up option does not exist for pc0 and pc1. pins pc6 and pc7 can be configured as hsync and hdriv inputs. after reset: pc3 is configured as input with pull-up. pc0, pc1 & pc4 to pc7 are configured in input without pull- up. pc2 is in output mode with the value 1 (high impedance). da0-da8. these pins are the nine pwm d/a out- puts of the on-chip d/a converters. these lines have push-pull outputs with 5v drive. the output repetition rate is 31.25khz (with 8mhz clock). vsync . this is the vertical synchronization pin. this pin is connected to an internal interrupt and is configured as input with pull-up and schmitt trig- ger. hda . this is the output pin of the on-chip 14-bit pwm d/a converter. this line is a push-pull out- put with standard drive. nmi . this pin is the non-maskable interrupt input and is configured as input with pull-up and schmitt trigger. figure 2. ST6373 pin configuration 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 o0/da0 o1/da1 o2/da2 o3/da3 ad0/pb0 ad1/pb1 ad2/pb2 ad3/pb3 ad4/pb4 hfly/ad5/pb5 vfly/ad6/pb6 ad7/pb7 pa0 pa1 hsynco/pa2 vsynco/pa3 clmpo/pa4 blko/pa5 scli/pa6 sdai/pa7 v ss v dd pc0/scld pc1/sdad pc2 pc3/extclk pc4/pwrin pc5 pc7/hdriv hda reset oscout oscin test/v pp (1) vsync nmi da4/o4 dar/o5 da6/o6 da7/o7 da8/o8 pc6/hsync (1) this pin is also the v pp input for otp/eprom devices
ST6373 7/64 table 2. pin summary pin function description da0 to da8 output, push-pull hda output, push-pull nmi input, pull-up, schmitt trigger input vsync input, pull-up, schmitt trigger test input, pull-down oscin input, resistive bias, schmitt trigger to reset logic only oscout output, push-pull reset input, pull-up, schmitt trigger input pa0-pa5 i/o, push-pull/open drain, software input pull-up, schmitt trigger input pa6-pa7 i/o, open-drain, no input pull-up, schmitt trigger input pb0-pb7 i/o, push-pull/open drain, software input pull-up, schmitt trigger input, analog input pc0-pc1 i/o, open-drain, no input pull-up, schmitt trigger input pc2-pc3 i/o, open-drain, 5v, software input pull-up, schmitt trigger input pc4-pc7 i/o, open-drain, 12v, no input pull-up, schmitt trigger input v dd ,v ss power supply pins
ST6373 8/64 1.3 memory spaces the mcu operates in three different memory spaces: stack space, program space and data space. 1.3.1 stack space the stack space consists of six 12 bit registers that are used for stacking subroutine and interrupt re- turn addresses plus the current program counter register. 1.3.2 program space the program space is physically implemented in the rom and includes all the instructions that are to be executed, as well as the data required for the immediate addressing mode instructions, the re- served test area and user vectors. it is addressed thanks to the 12-bit program counter register (pc register) and the st6 core can directly address up to 4k bytes of program space. nevertheless, the program space can be extended by the addition of 2-kbyte memory banks as it is shown infigure 2, in which the 16k bytes memory is described. these banks are addressed by pointing to the 000h-7ffh locations of the program space thanks to the program counter, and by writing the appro- priate code in the program rom page register (prpr) located at address cah in the data space. because interrupts and common subrour- outines should be available all the time only the lower 2k byte of the 4k program space are bank switched while the upper 2k byte can be seen as static space. table 3 gives the different codes that allows the selection of the corresponding banks. note that, from the memory point of view, the page 1 and the static page represent the same physical memory: it is only a different way of addressing the same location. figure 3. 16k-byte program space addressing figure 4. memory addressing diagram program counter space 0fffh 0800h 07ffh 0000h 0000h static page page 1 page 0 page1 static page page 2345 67 page page page page page 1fffh program space rom inte rrupt & reset vectors accumulator data ram bank select data rom window select ram x register y register v register w register data rom wind ow ram / eeprom banking area 000h 03fh 040h 07fh 080h 081h 082h 083h 084h 0c0h 0ffh 0-63 data space 0000h 0ff0h 0fffh program counter stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 stack level 6
ST6373 9/64 memory spaces (cont'd) program rom page register (prpr) address: cah - write only reset value: xxh d7-d3 . these bits are not used but have to be written to a0o. prpr2-prpr0. these are the program rom banking bits and the value loaded selects the cor- responding page to be addressed in the lower part of 4k program address space as specified in table 3.this register is undefined on reset. note: only the lower part of address space has been bankswitched because interrupt vectors and com- mon subroutines should be available all the time. the reason of this structure is due to the fact that it is not possible to jump from a dynamic page to an- other, unless jumping back to the static page, changing contents of prpr, and, then, jumping to a different dynamic page. care is required when handling the prpr as it is write only. for this reason, it is not allowed to change the prpr contents while executing inter- rupts drivers, as the driver cannot save and than re- store its previous content. anyway, this operation may be necessary if the sum of common routines and interrupt drivers will take more than 2k bytes; in this case could be necessary to divide the inter- rupt driver in a (minor) part in the static page (start and end), and in the second (major) part in one dy- namic page. if it is impossible to avoid the writing of this register in interrupts drivers, an image of this register must be saved in a ram location, and each time the program writes the prpr bit writes also the image register. the image register must be written first, so if an interrupt occurs between the two instructions the prpr is not affected. table 3. program memory page register coding table 4. ST6373 program memory map note *) : all reserved areas must be set to ffh in the rom code. 70 - - - - - prpr2 prpr1 prpr0 prpr2 prpr1 prpr0 pc11 memory page x x x 1 static page (page 1) 0000page0 0 0 1 0 page 1 (static page) 0100page2 0110page3 1000page4 1010page5 1100page6 1110page7 program memory page device address description *) page 0 0000h-007fh 0080h-07ffh reserved user rom page 1 astatico 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh user rom reserved interrupt vectors reserved nmi vector reset vector page 2 0000h-000fh 0010h-07ffh reserved user rom page 3 0000h-000fh 0010h-07ffh reserved user rom (end of 8k) page 4 0000h-000fh 0010h-07ffh reserved user rom page 5 0000h-000fh 0010h-07ffh reserved user rom (end of 12k) page 6 0000h-000fh 0010h-07ffh reserved user rom page 7 0000h-000fh 0010h-07ffh reserved user rom (end of 16k)
ST6373 10/64 memory spaces (cont'd) 1.3.3 data space the st6 core instruction set operates on a specif- ic space, referred to as the data space, which contains all the data necessary for the program. figure 5. data space the data space allows the addressing of ram (192 bytes), eeprom (384 bytes plus 128 bytes for the ddc spi), st6 core and peripheral regis- ters, as well as read-only data such as constants and look-up tables. *) these registers contain write only bits, in which case the bit operation instructions are not possi- ble. data ram/eep rom bank area 000h 03fh data rom wind ow area 040h 07fh x register 080h y register 081h v register 082h w register 083h data ram 084h 0bfh port a data register 0c0h port b data register 0c1h port c data registe r 0c2h reserved 0c3h port a direct ion registe r 0c4h port b direct ion registe r 0c5h port c direction register 0c6h reserved 0c7h interrupt option register 0c8h data rom windo w registe r 0c9h program rom page register 0cah *) i c spi data register 0cbh ddc spi data registe r 0cch port a option register 0cdh port b option register 0ceh reserved 0cfh adc result register 0d0h adc control register 0d1h *) timer 1 presc aler register 0d2h timer 1 counter registe r 0d3h timer 1 status /control register 0d4h timer 2 presc aler register 0d5h timer 2 counter registe r 0d7h watchd og register 0d8h mirror register 0d9h timer 3 prescaler register 0dah timer 3 counter register 0dbh timer 3 stat us/control register 0dch event counter data register 1 0ddh event counter data register 2 0deh *) sync processor control registe r 0dfh *) d/a 0/4 data control register 0e0h *) d/a 1/5 data control register 0e1h *) d/a 2/6 data control register 0e2h *) d/a 3/7 data control register 0e3h *) d/a 8 data control register 0e4h *) i c spi control registe r 1 0e5h *) i c spi control registe r 2 0e6h *) d/a bank register 0e7h data ram bank register 0e8h ddc eeprom control register 0e9h eeprom control register 0eah ddc spi control register 1 0ebh ddc spi control register 2 0ech nmi/pwri n/vsync interru pt regist er 0edh hda data register 1 0eeh *) hda data register 2 0efh *) period counter data register 0f0h period counter 1 and blank ctrl reg. 0f1h *) auto-cou nter register 0f2h scl latch and ddc2b address ctrl reg. 0f3h *) xor regist er 0f4h reserve d 0f5h 0feh accumulator 0ffh
ST6373 11/64 memory spaces (cont'd) data rom addressing. all the read-only data are physically implemented in the rom in which the program space is also implemented. the rom therefore contains the program to be executed and also the constants and the look-up tables needed for the program. the locations of data space in which the different constants and look-up tables are addressed by the st6 core can be considered as being a 64-byte window through which it is pos- sible to access to the read-only data stored in the rom. this window is located from the 40h ad- dress to the 7fh address in the data space and al- lows the direct reading of the bytes from the 000h address to the 03fh address in the rom. all the bytes of the rom can be used to store either in- structions or read-only data. indeed, the window can be moved by step of 64 bytes along the rom in writing the appropriate code in the write-only data rom window register (drwr, location c9h). the effective address of the byte to be read as a data in the rom is obtained by the concate- nation of the 6 less significant bits of the address in the data space (as less significant bits) and the content of the drwr (as most significant bits). so when addressing location 40h of data space, and 0 is loaded in the drwr, the physical addressed location in rom is 00h. data rom window register (dwr) address: c9h - write only reset value: xxh dwr7-dwr0 . these are the data rom window bits that correspond to the upper bits of data rom program space. this register is undefined after re- set. note: care is required when handling the drwr as it is write only. for this reason, it is not allowed to change the drwr contents while executing inter- rupts drivers, as the driver cannot save and than restore its previous content. if it is impossible to avoid the writing of this register in interrupts driv- ers, an image of this register must be saved in a ram location, and each time the program writes the drwr it writes also the image register. the image register must be written first, so if an inter- rupt occurs between the two instructions the drwr register is not affected. figure 6. data rom window memory addressing 70 dwr7 dwr6 dwr5 dwr4 dwr3 dwr2 dwr1 dwr0 data rom window register contents data space address 40h-7fh in instruction program space address 65432 0 543210 543210 read 1 6 7 8 9 10 11 01 vr01573b 12 1 0 data space address 59h 0 0 0 0 0 1 00 1 1 1 example: (dwr) dwr=28h 11 0000 00 00 1 rom address:a19h 11 13 01 7 0 0
ST6373 12/64 memory spaces (cont'd) 1.3.4 data ram/eeprom in the ST6373, 64 bytes of data ram are directly addressable in the data space from 80h to bfh ad- dresses. the additional 128 bytes of ram, and the 384 + 128 bytes of eeprom can be addressed using the 64-byte banks located between address- es 00h and 3fh. bank selection is carried out by programming the data ram bank register (dr- br) located at address e8h of the data space. in this way each bank of ram or eeprom can se- lect 64 bytes at a time. no more than one bank should be set at a time. data ram bank register (drbr) address: e8h - write only reset value: xxh drbr6 . this bit is reserved and must be held at a0o. drbr5, drbr4 . each of these bits, when set, will select one page of the eeprom dedicated to the ddc spi. drbr3, drbr2 . each of these bits, when set, will select oneram page. drbr7, drbr1, drbr0 . these bits select the eeprom pages. this register is undefined after reset. table 5 summarizes how to set the data ram bank register in order to select the various banks or pages. note: care is required when handling the drbr as it is write only. for this reason, it is not allowed to change the drbr contents while executing inter- rupts drivers, as the driver cannot save and than restore its previous content. if it is impossible to avoid the writing of this register in interrupts driv- ers, an image of this register must be saved in a ram location, and each time the program writes the drbr it writes also the image register. the im- age register must be written first, so if an interrupt occurs between the two instructions the drbr is not affected. 1.3.5 eeprom description the data space of ST6373 devices, from 00h to 3fh, is paged as described in table 5. the 512 bytes of eeprom are located in eight pages of 64 bytes (see table 3 below). table 5. data ram bank register set-up 70 drbr 7 drbr 6 drbr 5 drbr 4 drbr 3 drbr 2 drbr 1 drbr 0 drbr value selection hex. binary 01h 0000 0001 eeprom page 0 02h 0000 0010 eeprom page 1 03h 0000 0011 eeprom page 2 04h 0000 0100 ram page 2 08h 0000 1000 ram page 3 10h 0001 0000 ddc eeprom page 0 20h 0010 0000 ddc eeprom page 1 81h 1000 0001 eeprom page 3 82h 1000 0010 eeprom page 4 83h 1000 0011 eeprom page 5
ST6373 13/64 memory spaces (cont'd) by programming the data ram bank register, drbr, the user can select the bank or page leav- ing unaffected the means of addressing the static registers. the way to address the adynamico page is to set the drbr as described in table 5 (e.g. to select eeprom page 0, the drbr has to be load- ed with content 01h, see data ram/eeprom ad- dressing for additional information). bits 0,1 and 4,5,7 of the drbr are dedicated to the standard eeprom and ddc eeprom respectively. the eeprom pages do not require dedicated in- structions to be accessed in reading or writing. the standard eeprom is controlled by the eep- rom control register, eecr, the ddc eeprom is controlled by the ddc eprom control register deecr, in the same way. any eeprom location can be read just like any other data location, also in terms of access time. to write an eeprom location takes an average time of 5ms and during this time the eeprom is not accessible by the core. a busy flag can be read by the core to know the eeprom status be- fore trying any access. in writing the eeprom can work in two modes: byte mode (bmode) and par- allel mode (pmode). thebmode is the normal way to use the eeprom and consists in access- ing one byte at a time. the pmode consists in ac- cessing 8 bytes per time. eeprom control register (eecr) address: eah - read/write reset value: 00h ddc eeprom control register (ddceecr) address: e9h - read/write reset value: 00h d7 . not used sb . write only. if this bit is set the eeprom is disabled (any access will be meaningless) and the power consumption of the eeprom is reduced to the leakage values. d5, d4 . reserved for testing purposes, they must be set to zero. ps . set only. once in parallel mode, as soon as the user software sets the ps bit the parallel writing of the 8 adjacent registers will start. ps is internally reset at the end of the programming pro- cedure. note that less than 8 bytes can be written; after parallel programming the remaining unde- fined bytes will have no particular content. pe . write only. this bit must be set by the user program in order to perform parallel programming (more bytes per time). if pe is set and the aparallel start bito (ps) is low, up to 8 adjacent bytes can be written at the maximum speed, the content being stored in volatile registers. these 8 adjacent bytes can be considered as row, whose a7, a6, a5, a4, a3 are fixed while a2, a1 and a0 are the changing bytes. pe is automatically reset at the end of any parallel programming procedure. pe can be reset by the user software before starting the program- ming procedure, leaving unchanged the eeprom registers. bs . read only. this bit will be automatically set by the core when the user program modifies an eeprom register. the user program has to test it before any read or write eeprom operation; any attempt to access the eeprom while abusy bito is set will be aborted and the writing procedure in progress completed. en . write only. this bit must be set to one in order to write any eeprom register. if the user program will attempt to write the eeprom when en= a0o the involved registers will be unaffected and the abusy bito will not be set. notes : when the eeprom is busy (bs = a1o) the eecr cannot be accessed in write mode, it is only possi- ble to read bs status. this implies that, as long as the eeprom is busy, it is not possible to change the status of the eeprom control register. eecr bits 4 and 5 are reserved for test purposes, and must never be set. 70 -sb re- served re- served ps pe bs en 70 -sb re- served re- served ps pe bs en
ST6373 14/64 memory spaces (cont'd) additional notes on parallel mode . if the user wants to perform a parallel programming the first action should be the setting of the pe bit; from this moment, the first time the eeprom will be ad- dressed in writing, the row address will be latched and it will be possible to change it only at the end of the programming procedure or by reset- setting pe without programming the eeprom. after the row address latching the core can aseeo just one eeprom row (the selected one) and any attempt to write or read other rows will produce errors. do not read the eeprom while pe is set. as soon as pe bit is set, the 8 volatile row latch- es are cleared. from this moment the user can load data in the whole row or just in a subset. ps setting will modify the eeprom registers corre- sponding to the row latches accessed after pe. for example, if the software sets pe and accesses eeprom in writing at addresses 18h,1ah,1bh and then sets ps, these three registers will be modified at the same time; the remaining bytes will have no particular content. note that pe is inter- nally reset at the end of the programming proce- dure. this implies that the user must set pe bit be- tween two parallel programming procedures. any- way the user can set and then reset pe without performing any eeprom programming. ps is a set only bit and is internally reset at the end of the programming procedure. note that if the user tries to set ps while pe is not set there will not be any programming procedure and the ps bit will be un- affected. consequently ps bit can not be set if en is low. ps can be affected by the user set if, and only if, en and pe bits are also set to one.
ST6373 15/64 1.4 memory programming 1.4.1 program memory the ST6373 otp and eprom mcus can be pro- grammed with a range of eprom programming tools available from sgs-thomson. eprom/otp programming mode is set by a +12.5v voltage applied to the test/v pp pin. the programming flow is described in the user manual of the eprom programming tool. 1.4.2 option byte the option byte allows otp and eprom ver- sions to be configured to offer the same features available as mask options in rom devices. the option byte's content is automatically read, and the selected options enabled on reset. the option byte can only be accessed during pro- gramming mode. access is either automatic (copy from a master device) or by selecting the option byte programming mode of the programmer. the option byte is located in a non-user map. no address needs to be specified. option byte bit 3 = i2c clock speed : 0 = 100khz (default) 1 = 400khz all other bits must be programmed as shown in the register table above. the option byte is written during programming ei- ther by using the pc menu (pc driven mode) or automatically (stand-alone mode). 1.4.3 eprom erasure thanks to the transparent window present in the eprom package, its memory contents may be erased by exposure to uv light. erasure begins when the device is exposed to light with a wavelength shorter than 4000?. it should be noted that sunlight, as well as some types of artifi- cial light, includes wavelengths in the 3000-4000? range which, on prolonged exposure, can cause erasure of memory contents. it is thus recom- mended that eprom devices be fitted with an opaque label over the window area in order to pre- vent unintentional erasure. the recommended erasure procedure for eprom devices consists of exposure to short wave uv light having a wavelength of 2537?. the minimum recommended integrated dose (intensity x expo- sure time) for complete erasure is 15wsec/cm 2 . this is equivalent to an erasure time of 15-20 min- utes using a uv source having an intensity of 12mw/cm 2 at a distance of 25mm (1 inch) from the device window. 70 0000 x 010
ST6373 16/64 2 central processing unit 2.1 introduction the cpu core of st6 devices is independent of the i/o or memory configuration. as such, it may be thought of as an independent central processor communicating with on-chip i/o, memory and pe- ripherals via internal address, data, and control buses. in-core communication is arranged as shown in figure 1; the controller being externally linked to both the reset and oscillator circuits, while the core is linked to the dedicated on-chip pe- ripherals via the serial data bus and indirectly, for interrupt purposes, through the control registers. 2.2 cpu registers the st6 family cpu core features six registers and three pairs of flags available to the program- mer. these are described in the following para- graphs. accumulator (a) . the accumulator is an 8-bit general purpose register used in all arithmetic cal- culations, logical operations, and data manipula- tions. the accumulator can be addressed in data space as a ram location at address ffh. thus the st6 can manipulate the accumulator just like any other register in data space. indirect registers (x, y). these two indirect reg- isters are used as pointers to memory locations in data space. they are used in the register-indirect addressing mode. these registers can be ad- dressed in the data space as ram locations at ad- dresses 80h (x) and 81h (y). they can also be ac- cessed with the direct, short direct, or bit direct ad- dressing modes. accordingly, the st6 instruction set can use the indirect registers as any other reg- ister of the data space. short direct registers (v, w). these two regis- ters are used to save a byte in short direct ad- dressing mode. they can be addressed in data space as ram locations at addresses 82h (v) and 83h (w). they can also be accessed using the di- rect and bit direct addressing modes. thus, the st6 instruction set can use the short direct regis- ters as any other register of the data space. program counter (pc). the program counter is a 12-bit register which contains the address of the next rom location to be processed by the core. this rom location may be an opcode, an oper- and, or the address of an operand. the 12-bit length allows the direct addressing of 4096 bytes in program space. figure 7. st6 core block diagram program reset opcode flag values 2 controller flags alu a-data b-data addre ss/read line data space inter rupts data ram/eepro m data rom/eprom results to data space (write line) rom/eprom dedications accumulator control signals oscin oscout address decoder 256 12 program counter and 6 layer stack 0,01 to 8mhz vr01811
ST6373 17/64 cpu registers (cont'd) however, if the program space contains more than 4096 bytes, the additional memory in program space can be addressed by using the program bank switch register. the pc value is incremented after reading the ad- dress of the current instruction. to execute relative jumps, the pc and the offset are shifted through the alu, where they are added; the result is then shifted back into the pc. the program counter can be changed in the following ways: - jp (jump) instruction. . . . . pc=jump address - call instruction . . . . . ....pc=calladdress - relative branch instruction . pc= pc +/- offset - interrupt . . . . . . . . . . . . . .pc=interrupt vector - reset . . ...............pc=r eset vector - ret & reti instructions . . . . pc= pop (stack) - normal instruction . . . . . . .......pc=pc+1 flags (c, z) . the st6 cpu includes three pairs of flags (carry and zero), each pair being associated with one of the three normal modes of operation: normal mode, interrupt mode and non maskable interrupt mode. each pair consists of a carry flag and a zero flag. one pair (cn, zn) is used during normal operation, another pair is used dur- ing interrupt mode (ci, zi), and a third pair is used in the non maskable interrupt mode (cnmi, zn- mi). the st6 cpu uses the pair of flags associated with the current mode: as soon as an interrupt (or a non maskable interrupt) is generated, the st6 cpu uses the interrupt flags (resp. the nmi flags) instead of the normal flags. when the reti in- struction is executed, the previously used set of flags is restored. it should be noted that each flag set can only be addressed in its own context (non maskable interrupt, normal interrupt or main rou- tine). the flags are not cleared during context switching and thus retain their status. the carry flag is set when a carry or a borrow oc- curs during arithmetic operations; otherwise it is cleared. the carry flag is also set to the value of the bit tested in a bit test instruction; it also partici- pates in the rotate left instruction. the zero flag is set if the result of the last arithme- tic or logical operation was equal to zero; other- wise it is cleared. switching between the three sets of flags is per- formed automatically when an nmi, an interrupt or a reti instructions occurs. as the nmi mode is automatically selected after the reset of the mcu, the st6 core uses at first the nmi flags. stack. the st6 cpu includes a true lifo hard- ware stack which eliminates the need for a stack pointer. the stack consists of six separate 12-bit ram locations that do not belong to the data space ram area. when a subroutine call (or inter- rupt request) occurs, the contents of each level are shifted into the next higher level, while the content of the pc is shifted into the first level (the original contents of the sixth stack level are lost). when a subroutine or interrupt return occurs (ret or reti instructions), the first level register is shifted back into the pc and the value of each level is popped back into the previous level. since the accumula- tor, in common with all other data space registers, is not stored in this stack, management of these registers should be performed within the subrou- tine. the stack will remain in its adeepesto position if more than 6 nested calls or interrupts are execut- ed, and consequently the last return address will be lost. it will also remain in its highest position if the stack is empty and a ret or reti is executed. in this case the next instruction will be executed. figure 8. st6 cpu programming mode l short direct addressing mode vregister wregister program counter six levels stack register cz normal flags interrupt flags nmi flags index register va000423 b7 b7 b7 b7 b7 b0 b0 b0 b0 b0 b0 b11 accumulator yreg.pointer x reg. pointer cz cz
ST6373 18/64 3 clocks, reset, interrupts and power saving modes 3.1 on-chip clock oscillator the internal oscillator circuit is designed to require a minimum of external components. a crystal quartz, a ceramic resonator, or an external signal (provided to the oscin pin) may be used to gener- ate a system clock with various stability/cost trade- offs. the typical clock frequency is 8mhz. please note that different frequencies will affect the oper- ation of those peripherals (d/as, spi) whose refer- ence frequencies are derived from the system clock. the different clock generator connection schemes are shown in figure 1 and 2. one machine cycle takes 13 oscillator pulses; 12 clock pulses are needed to increment the pc while and additional 13th pulse is needed to stabilize the internal latch- es during memory addressing. this means that with a clock frequency of 8mhz the machine cycle is 1.625 m sec. the crystal oscillator start-up time is a function of many variables: crystal parameters (especially rs), oscillator load capacitance (cl), ic parame- ters, ambient temperature, and supply voltage.it must be observed that the crystal or ceramic leads and circuit connections must be as short as possi- ble. typical values for cl1 and cl2 are in the range of 15pf to 22pf but these should be chosen based on the crystal manufacturers specification. typical input capacitance for oscin and oscout pins is 5pf. the oscillator output frequency is internally divided by 13 to produce the machine cycle and by 12 to produce the timers and the watchdog clock. a byte cycle is the smallest unit needed to execute any operation (i.e., increment the program coun- ter). an instruction may need two, four, or five byte cycles to be executed (seetable 1). table 6. instruction timing with 8mhz clock figure 9. clock generator option 1 figure 10. clock generator option 2 figure 11. oscin, oscout diagram instruction type cycles execution time branch if set/reset 5 cycles 8.125 m s branch & subroutine branch 4 cycles 6.50 m s bit manipulation 4 cycles 6.50 m s load instruction 4 cycles 6.50 m s arithmetic & logic 4 cycles 6.50 m s conditional branch 2 cycles 3.25 m s program control 2 cycles 3.25 m s osc in osc out c l1 c l2 st6xxx crystal/ resonator clock va0016b osc in osc out st6xxx external clock nc va0015c va00462 oscout in oscin, oscout (quartz pins) oscin 1m v dd dd v
ST6373 19/64 3.2 resets the mcu can be reset in three ways: by the external reset input being pulled low; by power-on reset; by the digital watchdog peripheral timing out. 3.2.1 reset input the reset pin may be connected to a device of the application board in order to reset the mcu if required. the reset pin may be pulled low in run, wait or stop mode. this input can be used to reset the mcu internal state and ensure a correct start-up procedure. the pin is active low and features a schmitt trigger input. the internal reset signal is generated by adding a delay to the external signal. therefore even short pulses on the reset pin are acceptable, provided v dd has completed its rising phase and that the oscillator is running correctly (normal run or wait modes). the mcu is kept in the reset state as long as the reset pin is held low. if reset activation occurs in run or wait modes, processing of the user program is stopped (run mode only), the inputs and outputs are con- figured as inputs with pull-up resistors if available. when the level on the reset pin then goes high, the initialization sequence is executed following expiry of the internal delay period. if reset pin activation occurs in the stop mode, the oscillator starts up and all inputs and outputs are configured as inputs with pull-up resistors if available. when the level of the reset pin then goes high, the initialization sequence is executed following expiry of the internal delay period. 3.2.2 power-on reset the function of the por circuit consists in waking up the mcu at an appropriate stage during the power-on sequence. at the beginning of this se- quence, the mcu is configured in the reset state: all i/o ports are configured as inputs with pull-up resistors and no instruction is executed. when the power supply voltage rises to a sufficient level, the oscillator starts to operate, whereupon an internal delay is initiated, in order to allow the oscillator to fully stabilize before executing the first instruction. the initialization sequence is executed immediate- ly following the internal delay. the internal delay is generated by an on-chip counter. the internal reset line is released 2048 in- ternal clock cycles after release of the external re- set. the internal por device is a static mechanism which forces the reset state when v dd is below a threshold voltage in the range 3.4 to 4.2 volts (see figure 1). the circuit guarantees that the mcu will exit or enter the reset state correctly, without spu- rious effects, ensuring, for example, that eeprom contents are not corrupted. note : this feature is not available on otp/eprom devices. figure 12. power on/off reset operation figure 13. reset and interrupt processing vr02037 v dd 4.2 3.4 t v t power on/off threshold dd reset in t latch cleare d nmi mask set res et ( if pr esent ) selec t nmi mod e flags is rese t still pr esent? yes pu t ffeh on addr essbus from r eset locations ffe/fff no fetch ins truc tion load pc va000427
ST6373 20/64 resets (cont'd) 3.2.3 watchdog reset the mcu provides a watchdog timer function in order to ensure graceful recovery from software upsets. if the watchdog register is not refreshed before an end-of-count condition is reached, the internal reset will be activated. this, amongst oth- er things, resets the watchdog counter. the mcu restarts just as though the reset had been generated by the reset pin, including the built-in stabilisation delay period. 3.2.4 application note no external resistor is required between v dd and the reset pin, thanks to the built-in pull-up device. 3.2.5 mcu initialization sequence when a reset occurs the stack is reset, the pc is loaded with the address of the reset vector (locat- ed in program rom starting at address 0ffeh). a jump to the beginning of the user program must be coded at this address. following a reset, the in- terrupt flag is automatically set, so that the cpu is in non maskable interrupt mode; this prevents the initialisation routine from being interrupted. the in- itialisation routine should therefore be terminated by a reti instruction, in order to revert to normal mode and enable interrupts. if no pending interrupt is present at the end of the initialisation routine, the mcu will continue by processing the instruction immediately following the reti instruction. if, how- ever, a pending interrupt is present, it will be serv- iced. figure 14. reset and interrupt processing figure 15. reset circuit reset reset vector jp jp:2 bytes/4 cycles reti reti: 1 byte/2 cycles initialization routine va00181 va0200e to st6 reset st6 internal reset oscillator signal watchdog reset v dd 300k reset (active low) counter 1k power on/off reset
ST6373 21/64 3.3 hardware activated digital watchdog function the hardware activated digital watchdog function consists of a down counter that is automatically in- itialized after reset so that this function does not need to be activated by the user program. as the watchdog function is always activated this down counter can not be used as a timer. the watchdog is using one data space register (hwdr location d8h). the watchdog register is set to feh on reset and immediately starts to count down, requiring no software start. similarly the hardware activated watchdog can not be stopped or delayed by soft- ware. the watchdog time can be programmed using the 6 msbs in the watchdog register, this gives the possibility to generate a reset in a time between 3072 to 196608 oscillator cycles in 64 possible steps. (with a clock frequency of 8mhz this means from 384ms to 24.576ms). the reset is prevented if the register is reloaded with the desired value before bits 2-7 decrement from all zeros to all ones. the presence of the hardware watchdog deacti- vates the stop instruction and a wait instruction is automatically executed instead of a stop. bit 1 of the watchdog register (set to one at reset) can be used to generate a software reset if cleared to zero). figure 1 shows the watchdog block diagram while figure 2 shows its working principle. figure 16. hardware activated watchdog block diagram rsff 8 data bus va00010 -2 -12 oscillator reset write reset db0 r s q db1.7 set load 7 8 -2 set clock
ST6373 22/64 hardware activated digital watchdog function (cont'd) hardware activated watchdog register (hwdr) address: d8h - read/write reset value: 0feh t1-t6 . these are the watchdog counter bits. it should be noted that d7 (t1) is the lsb of the counter and d2 (t6) is the msb of the counter, these bits are in the opposite order to normal. sr . this bit is set to one during the reset phase and will generate a software reset if cleared to ze- ro. c . this is the watchdog activation bit that is hard- ware set. the watchdog function is always activat- ed independently of changes of value of this bit. the register reset value is feh (bit 1-7 set to one, bit 0 cleared). figure 17. hardware activated watchdog working principle 70 t1 t2 t3 t4 t5 t6 sr c bit0 va00190 bit1 bit2 bit3 bit4 bit5 bit6 bit7 8-bit down counter osc-12 watchdog control register reset d0 d1 d2 d3 d4 d5 d6 d7
ST6373 23/64 3.4 interrupt the mcu core can manage 4 different maskable interrupt sources, plus one non-maskable interrupt source (top priority level interrupt). each source is associated with a particular interrupt vector that contains a jump instruction to the related interrupt service routine. each vector is located in the pro- gram space at a particular address (see table 7). when a source provides an interrupt request, and the request processing is also enabled by the mcu core, then the pc register is loaded with the address of the interrupt vector (i.e. of the jump in- struction). finally, the pc executes the jump in- struction and the interrupt routine is processed. the relationship between vector and source and the associated priority is hardware fixed for ST6373 devices. for some interrupt sources it is also possible to select by software the kind of event that will generate the interrupt. all interrupts can be disabled by writing to the gen bit (global interrupt enable) of the interrupt option register (address c8h). following a reset, the ST6373 is in non maskable interrupt mode, so no interrupts will be accepted and nmi flags will be used, until a reti instruction is executed. if an in- terrupt is executed, one special cycle is made by the core, during that the pc is set to the related in- terrupt vector address. a jump instruction at this address has to redirect program execution to the beginning of the related interrupt routine. the in- terrupt detecting cycle, also resets the related in- terrupt flag (not available to the user), so that an- other interrupt can be stored for this current vector, while its driver is under execution. if additional interrupts arrive from the same source, they will be lost. nmi can interrupt other in- terrupt routines at any time, while other interrupts cannot interrupt each other. if more than one inter- rupt is waiting for service, they are executed ac- cording to their priority. the lower the number, the higher the priority. priority is, therefore, fixed. in- terrupts are checked during the last cycle of an in- struction (reti included). level sensitive inter- rupts have to be valid during this period. table 7 details the different interrupt vec- tors/sources relationships. 3.4.1 interrupt vectors/sources the mcu core includes 5 different interrupt vec- tors in order to branch to 5 different interrupt rou- tines. the interrupt vectors are located in the fixed (or static) page of the program space. table 7. interrupt vectors/sources relationships the interrupt vector associated with the non- maskable interrupt source is named interrupt vec- tor #0. it is located at the (ffch, ffdh) addresses in the program space. this vector is associated with the nmi pin. the interrupt vectors located at addresses (ff6h,ff7h), (ff4h,ff5h), (ff2h,ff3h), (ff0h,ff1h) are named interrupt vectors #1, #2, #3 and #4 respectively. these vectors are associ- ated with timer 3, port a and port b interrupts (#1), timer 2, vsync and i 2 c spi (#2), timer 1 and the ddc spi (#3) and the adc and pc4 (pwrin) (#4). interrupt source associated vector vector address nmi pin interrupt vector # 0 (nmi) 0ffch-0ffdh timer 3 i/o port a, i/o port b interrupt vector # 1 0ff6h-0ff7h timer 2 vsync, i 2 c spi interrupt vector #2 0ff4h-0ff5h timer 1 ddc spi interrupt vector #3 0ff2h-0ff3h adc pwrin interrupt vector #4 0ff0h-0ff1h
ST6373 24/64 interrupts (cont'd) 3.4.2 interrupt priority the non-maskable interrupt request has the high- est priority and can interrupt any other interrupt routines at any time, nevertheless the other inter- rupts cannot interrupt each other. if more than one interrupt request is pending, they are processed by the mcu core according to their priority level: vector #1 has the higher priority while vector #4 the lower. the priority of each interrupt source is hardware fixed. 3.4.3 interrupt option register the interrupt option register (ior register, loca- tion c8h) is used to enable/disable the individual interrupt sources and to select the operating mode of the external interrupt inputs. this register is ad- dressed in the data space as a ram location at address c8h, nevertheless it is write-only register that can not be accessed with single-bit opera- tions. the operating modes of the external inter- rupt inputs associated to interrupt vectors #1 and #2 are selected through bits 4 and 5 of the ior register. interrupt option register (ior) address: (c8h) - write only reset value: xx00xxxxb d7 . not used. el1 . this is the edge/level selection bit of inter- rupt #1. when set to one, the interrupt is generat- ed on low level of the related signal; when cleared to zero, the interrupt is generated on falling edge. the bit is cleared to zero after reset. es2 . this is the edge selection bit on interrupt #2. this bit is used in ST6373 devices for vsync de- tection, the interrupt for timer 2 and the i 2 cspi.it is cleared to zero on reset (falling edge), and must be maintained at 0 if the timer 2 and i 2 c interrupts are to be used. the vsync interrupt may be con- figured to act on the falling edge (es2=0) or rising edge (es2=1) according to the system design. gen . this is the global enable bit. when set to one all interrupts are globally enabled; when this bit is cleared to zero all interrupts are disabled (ex- cluding nmi) independently to the individual inter- rupt enable bit of each peripheral. d3 - d0 . these bits are not used. nmi/pwr/vsync interrupt register (npvir) b7: vsyncst: (read & write, 0 written on reset) b6: vsyncen : (read & write, 0 written on reset) b5: pwrflag: (read &write, undefined on reset) b4: pwinten: (write only, 0 written on reset) b3: pwredge : (write only, 0 written on reset) b2: nmiflag: (read & write, undefined on reset) b1: nminten: (write only, 0 written on reset) b0: nmiedge: (write only, 0 written on reset) note that no bit operation instructions are possible. the input latch is activated on either the positive or negative edge of the nmi (respectively pwrin) signal: if nmiedge (resp. pwredge) is high the latch will be triggered on the rising edge of the sig- nal at nmi (resp. pwrin); if this bit is low the latch will be triggered on the falling edge. an interrupt can be generated if it is enabled: if nminten (resp. pwinten) is high, then the out- put of the latch may generate an interrupt on vec- tor #0 (resp. vector #4); if this bit is low the inter- rupt is disabled. the status of the latch is read with nmiflag (re- sp. pwrflag): if nmiflag (resp. pwrflag) is high, a signal has been latched. the latch can be reset by setting nmiflag (resp. pwrflag). the vsync input is linked to the interrupt vector # 2 through a latch. if 1 is written in vsyncst the latch will be trig- gered on the rising edge of the signal at vsync, if vsyncst is low the latch will be triggered on the falling edge (0 written on reset). an interrupt can be generated only if vsyncen is at 1. writing a 1 in vsyncen will also reset the latch (0 written on reset). the status of the latch is read through the bit vsyncen; reading a 1 means that a signal has been latched. the status of the vsync pin is read with the vsyncst bit. 70 - el1 es2 gen ---- 70 d7 d6 d5 d4 d3 d2 d1 d0
ST6373 25/64 interrupts (cont'd) 3.4.4 interrupt procedure the interrupt procedure is very similar to a call pro- cedure; the user can consider the interrupt as an asynchronous call procedure. as this is an asyn- chronous event the user does not know about the context and the time at which it occurred. as a re- sult the user should save all the data space regis- ters which will be used inside the interrupt rou- tines. there are separate sets of processor flags for normal, interrupt and non-maskable interrupt modes which are automatically switched and so these do not need to be saved. the following list summarizes the interrupt proce- dure (refer also to figure 20. interrupt processing flow chart): interrupt detection the flags c and z of the main routine are ex- changed with the flags c and z of the interrupt routine (resp. the nmi flags) the value of the pc is stored in the first level of the stack - the normal interrupt lines are inhibit- ed (nmi still active) the edge flip-flop is reset the related interrupt vector is loaded in the pc. user selected registers are saved inside the in- terrupt service routine (normally on a software stack) the source of the interrupt is found by polling (if more than one source is associated to the same vector) interrupt servicing return from interrupt (reti) automatically the mcu core switches back to the normal flags (resp. the interrupt flags) and pops the previous pc value from the stack the interrupt routine begins usually by the identifi- cation of the device that has generated the inter- rupt request. the user should save the registers which are used inside the interrupt routine (that holds relevant data) into a software stack. after the reti instruction execution, the core car- ries out the previous actions and the main routine can continue. figure 18. interrupt processing flow-chart 3.4.5 ST6373 interrupt details interrupt #0. the nmi interrupt is connected to the first interrupt #0 (nmi, pin 27). if the nmi interrupt is disabled at the latch circuitry, then it will be high. the #0 interrupt input detects a high to low level. note that once #0 has been latched, then the only way to remove the latched #0 signal is to service the interrupt. #0 can interrupt the other interrupts. load pc from interrupt vector ( ffc / ffd ) set interrupt mask push the pc into the stack select internal mode flag check if there is an interrupt request and interrupt mask instruction was the instruction a reti is the core already in normal mode ? fetch instruction execute instruction clear interrupt mask select program flags o pop o the stacked pc no no yes yes ? ? no yes va 000014
ST6373 26/64 interrupts (cont'd) interrupt #1 . the timer 3 interrupt and the port a and b interrupts are connected by a logical and function to interrupt #1 (0ff6h). the timer 3 in- terrupt generates a low level (which is latched in the timer) requiring that the interrupt 1 edge/level bit is set to 1. the i/o port a and b interrupts may be set to generate an interrupt on the falling edge or low level state of the input (el1 = 1 or el1 = 0 respectively) according to the external connec- tions.note that if a low level is maintained on an i/o bit configured as acting on a low level after the interrupt is generated, the mcu will return to the interrupt state after exiting the reti instruction from the first interrupt service. interrupt #2. the vsync, timer 2 and i 2 c spi in- terrupt are connected by a logical and function to interrupt #2. bit 5 of the interrupt option register c8h is used to select the negative edge (es2=0) or the positive edge (es2=1) to trigger the inter- rupt #2.for the correct operation of the timer 2 and i 2 c spi interrupts, the falling edge should be selected (es2 = 0).for the vsync interrupt, either edge can be selected, depending on the operation required. for example if the rising edge on vsync is the trigger, and after receiving the interrupt edge, the vsync trigger level is switched to the falling edge, the time between the rising and falling edge (e.g. the display time) to be determined. the vsync interrupt is controlled in register npvir at address edh. note that once an edge has been latched, then the only way to remove the latched signal is to service the interrupt. care must be taken not to generate spurious interrupts. for example, changing the edge selection bit from falling edge to rising edge when the vsync input is high (or disabled in np- vir) will cause a spurious interrupt.(see interrupt circuit diagram) interrupt #3 . the timer 1 and ddc spi interrupt are connected by a logical and function to inter- rupt #3. this interrupt is triggered on detection of a low level latched in the timer and ddc spi. interrupt #4 . the pwrin and analog to digital converter interrupts are connected by a logical and to interrupt #4 (0ff0h). the pwrin interrupt is controlled through the npvir register at ad- dress edh, and the phase unlock interrupt is con- trolled through spcr at address dfh. the #4 in- terrupt input detects a low level. a simple latch is provided from the pc4 (pwrin) pin in order to generate the pwrint signal. this latch can be triggered by either the positive or negative edge of the pwrin signal (bit 3, pwredge, of register npvir edh). the latch is reset by software. notes : global disable does not reset edge sensitive inter- rupt flags. these edge sensitive interrupts become pending again when global disabling is released. moreover, edge sensitive interrupts are stored in the related flags also when interrupts are globally disabled, unless each edge sensitive interrupt is also individually disabled before the interrupting event happens. global disable is done by clearing the gen bit of interrupt option register, while any individual disable is done in the control register of the peripheral. the on-chip timer peripherals have an interrupt request flag bit (tmz), this bit is set to one when the device wants to generate an interrupt request and a mask bit (eti) that must be set to one to allow the transfer of the flag bit to the core.
ST6373 27/64 interrupts (cont'd) figure 19. interrupt circuit diagram ff clr clk q i 0 start start 1 i q clk clr ff nmi 1 0 mux iorreg.c8h,bit6 iorreg.c8h,bit5 ff clr clk q i 2 start int #4 (ff0,1) int #3 (ff2,3) int #2 (ff4,5) int #1 (ff6,7) int #0 - nmi (ffc,d) ior reg c h, bit 4 : gen re start from stop/wa it from register port a,b single bit enable va0426q v dd pbe pb e pbe port a,b bits npvir bit 6 dd v npvir bit 2 ff clr clk q npvir bit 1 timer 3 tscr3 bit 6 v sync dd v timer 2 tscr2 bit 6 scr1 bit 5 i c spi 2 npvir bit 0 timer 1 tscr1 bit 6 ddc s pi v pc4/pwrin dd npvir bit 3 clr npvir bit 5 q clk ff npvir bit 4 adc adcr bit 7 slacr bit 1 scr1 bit 5
ST6373 28/64 3.5 power saving modes stop and wait modes have been implemented in the st638x in order to reduce the current con- sumption of the device during idle periods. these two modes are described in the following para- graphs. since the hardware activated digital watchdog function is present, the stop instruc- tion is de-activated and any attempt to execute it will cause the automatic execution of a wait in- struction. 3.5.1 wait mode the configuration of the mcu in the wait mode occurs as soon as the wait instruction is execut- ed. the microcontroller can also be considered as being in a asoftware frozeno state where the core stops processing the instructions of the routine, the contents of the ram locations and peripheral registers are saved as long as the power supply voltage is higher than the ram retention voltage but where the peripherals are still working. the wait mode is used when the user wants to re- duce the consumption of the mcu when it is in idle, while not losing count of time or monitoring of external events. the oscillator is not stopped in or- der to provide clock signal to the peripherals. the timers counting may be enabled (writing the psi bit in tscr1 register) and the timer interrupt may be also enabled before entering the wait mode; this allows the wait mode to be left when timer in- terrupt occurs. if the exit from the wait mode is performed with a general reset (either from the activation of the external pin or by watchdog reset) the mcu will enter a normal reset procedure as described in the reset chapter. if an interrupt is generated during wait mode the mcu behaviour depends on the state of the mcu core before the initialization of the wait sequence, but also of the kind of the interrupt request that is generated. this case will be described in the following paragraphs. in any case, the mcu core does not generate any delay after the occurrence of the interrupt because the oscillator clock is still available. 3.5.2 stop mode since the hardware activated watchdog is present on the st638x, the stop instruction has been de- activated. any attempt to execute a stop instruc- tion will cause a wait instruction to be executed instead. 3.5.3 exit from wait mode the following paragraphs describe the output pro- cedure of the mcu core from wait mode when an interrupt occurs. it must be noted that the re- start sequence depends on the original state of the mcu (normal, interrupt or non-maskable interrupt mode) before the start of the wait sequence, but also of the type of the interrupt request that is gen- erated. in all cases the gen bit of ior has to be set to 1 in order to restart from wait mode. con- trary to the operation of nmi in the run mode, the nmi is masked in wait mode if gen=0. normal mode . if the mcu core was in the main routine when the wait instruction has been exe- cuted, the core exits from wait mode as soon as an interrupt occurs; the corresponding interrupt routine is executed, and at the end of the interrupt service routine, the instruction that follows the wait instruction is executed if no other interrupts are pending. non-maskable interrupt mode . if the wait in- struction has been executed during the execution of the non-maskable interrupt routine, the mcu core outputs from wait mode as soon as any in- terrupt occurs: the instruction that follows the wait instruction is executed and the mcu core is still in the non-maskable interrupt mode even if an- other interrupt has been generated. normal interrupt mode . if the mcu core was in the interrupt mode before the initialization of the wait sequence, it outputs from the wait mode as soon as any interrupt occurs. nevertheless, two cases have to be considered: if the interrupt is a normal interrupt, the interrupt routine in which the wait was entered will be completed with the execution of the instruction that follows the wait and the mcu core is still in the interrupt mode. at the end of this routine pending interrupts will be serviced in accordance to their priority. if the interrupt is a non-maskable interrupt, the non-maskable routine is processed at first. then, the routine in which the wait was entered will be completed with the execution of the instruction that follows the wait and the mcu core is still in the normal interrupt mode. notes : if all the interrupt sources are disabled, the restart of the mcu can only be done by a reset activa- tion. the wait instruction is not executed if an en- abled interrupt request is pending. in st638x de- vices, the hardware activated digital watchdog function is present. as the watchdog is always ac- tivated, the stop instruction is de-activated and any attempt to execute the stop instruction will cause an execution of a wait instruction.
ST6373 29/64 4 on-chip peripherals 4.1 i/o ports the ST6373 microcontroller uses three i/o ports (a,b,c) with up to eight pins on each port. each line can be individually programmed either in the input mode or the output mode with the following software selectable options: input without interrupt and without pull-up (ports a, b and c) input with pull-up and with interrupt (pa0-pa5 and port b) input with pull-up without interrupt (pa0-pa5 and port b, pc2-pc7) analog inputs (pb0-pb7) open-drain output 12v, no pull-up (pc4-pc7) open-drain output 5v (pa0-pa7, pb0-pb7, pc0-pc3) push-pull output (pa0-pa5, pb0-pb7) spi control signals (pa6,pa7 for i 2 c spi, pc0,pc1,pc3 for ddc spi) horizontal timing inputs (pc6/hsync, pc7/hdriv external power in interrupt (pc4) the lines are organized in three ports (ports a, b, c). the ports occupy 8 registers in the data space. each bit of these registers is associated with a par- ticular line (for instance, the bits 0 of the port a da- ta, direction and option registers are associated with the pa0 line of port a). the three data registers (dra, drb, drc) are used to read the voltage level values of the lines programmed in the input mode, or to write the logic value of the signal to be output on the lines config- ured in the output mode. the port data registers can be read to get the effective logic levels of the pins, but they can be also written by the user soft- ware, in conjunction with the related data direc- tion register and option register (ports a and b only), to select the different input mode options. single-bit operations on i/o registers (bit set/reset instructions) are possible but care is necessary because reading in input mode is made from i/o pins and therefore might be influenced by the ex- ternal load, while writing will directly affect the port data register causing an undesired changes of the input configuration. the three data direction registers (ddra, ddrb, ddrc) allow the selection of the direction of each pin (input or output). the two option registers (ora and orb) are used to select the different port options available both in input and in output mode for ports a and b only. all the i/o registers can be read or written as any other ram location of the data space, so no extra ram cell is needed for port data storing and ma- nipulation. during the initialization of the mcu, all the i/o registers are cleared and the input mode with pull-up is selected on all the pins thus avoiding pin conflicts (with the exception of pc2 which is set to output mode with the value 1 (high impedance). figure 20. i/o port block diagram (pa0-pa5 and port b) va000413 reset input/output data direction register s controls in data register s to interrupt r egist er option v dd v dd out to adc shift r egister
ST6373 30/64 i/o ports (cont'd) 4.1.1 details of i/o ports a and b each pin of ports a and b can be individually pro- grammed as input or output with different input and output configurations. this is achieved by writing the relevant bit in the data register (dr), data direction register (ddr) and option register (or). table 8 shows all the port configurations that can be selected by user software. 4.1.1.1 input option description pull-up, high impedance option . all the input lines can be individually programmed with or with- out an internal pull-up according to the codes pro- grammed in the or and dr registers. if the pull-up is not selected, the input pin is in the high imped- ance state. interrupt option . all the input lines can be individ- ually connected by software to the interrupt lines of the mcu core according to the codes programmed in the or and dr registers. the pins of port a and b are aoredo and are connected to the interrupt associated to the vector #1. analog input option . the pb0-pb7 pins can be configured to be analog inputs according to the codes programmed in the or and dr registers. these analog inputs are connected to the on-chip 8-bit analog to digital converter. only one pin should be programmed as analog input at a time, otherwise the selected inputs will be shorted. table 8. i/o port options selection (ports a and b only) note x : means don't care. ddr or dr mode option 0 0 0 input with pull-up, no interrupt (reset state) 0 0 1 input no pull-up, no interrupt 0 1 0 input with pull-up, with interrupt 011 input no pull-up, no interrupt (port a pins) input analog input (port b pins) 1 0 x output open-drain output (10ma sink current for port a pins) 1 1 x output push-pull output (10ma sink current for port a pins)
ST6373 31/64 i/o ports (cont'd) 4.1.1.2 output option description output option port a and b pins in output modes can be set to open drain or push-pull modes (not for pa6 and pa7). port a bits set to output have a maximum 10ma current sink led drive capability. 4.1.1.3 i 2 c spi input/output if the user uses the i 2 c serial peripheral interface, the i/o lines pa6 and pa7 should be set in output mode with the open-drain configuration; the corre- sponding data bit must set to one. note . switching the i/o ports with interrupt (ports a and b) from one state to another should be done in a way that no unwanted side effects can hap- pen. the recommended safe transitions are shown below. all other transitions are risky and should be avoided during change of operation mode as it is most likely that there will be an un- wanted side-effect such as interrupt generation or two pins shorted together by the analog input lines. single bit instructions (set, res, jrr and jrs) should be used very carefully with port a and b data registers because these instructions make an implicit read and write back of the whole ad- dressed register byte. in port input mode however data register address reads from input pins, not from data register latches and data register infor- mation in input mode is used to set characteristics of the input pin (interrupt, pull-up, analog input), therefore these characteristics may be uninten- tionally reprogrammed, depending on the state of input pins. as general rule is better to use single bit instructions on data register only when the whole port is in output mode. if input or mixed configura- tion is needed it is recommended to keep a copy of the data register in ram. on this copy it is possible to use single bit instructions, then the copy register could be written into the port data register. set bit, datacopy ld a, datacopy ld dra, a 4.1.2 details of i/o port c port c . when programmed as an input an internal pull-up can be switched active under program con- trol. when programmed as an output the port c i/o pins will operate in the open-drain mode. pc0- pc3 are available as open-drain capable of with- standing a maximum vdd+0.3v. pc4-pc7 are available as open-drain capable of withstanding 12v and have no resistive pull-up in input mode. if the user uses the ddc serial peripheral inter- face, the i/o lines pc0 and pc1 should be set in output mode while the open-drain configuration is hardware fixed; the corresponding data bit must set to one.if the latched interrupt functions are used (hsync,(hsync, hdrive, pwrin) then the corresponding pins should be set to input mode. figure 21. state transition diagram for safe transitions (ports a and b) note *.xxx = ddr, or, dr bits respectively interrupt pull-up output open drain output push-pull input pull-up (reset state) input analog output open drain output push-pull input 010* 000 100 110 011 001 101 111
ST6373 32/64 i/o ports (cont'd) table 9. i/o port option selections note 1 . provided the correct configuration has been selected. mode available on (1) schematic input pa0-pa7 pb0-pb7 pc0-pc7 input with pull up pa0-pa5 pb0-pb7 pc2, pc3 input with pull up with interrupt pa0-pa5 pb0-pb7 analog input pb0-pb7 open drain output 5ma / v dd +0.3v open drain output 10ma / v dd +0.3v open drain output 5ma / 12v pb0-pb7 pc0-pc7 pa0-pa7 pc4-pc7 push-pull output 5ma push-pull output 10ma pb0-pb7 pa0-pa5 data in interrupt data in interrupt data in interrupt data out adc data out
ST6373 33/64 i/o ports (cont'd) 4.1.2.1 port c i/o pin programming each port c pin can be individually programmed as input or output. this is achieved by writing to the relevant bit in the data (drc) and data direc- tion register (ddrc). table 9 shows all the port configurations that can be selected by the user software. 4.1.2.2 port c input/output configurations the following schematics show the i/o lines hard- ware configuration for the different options. figure 31 shows the i/o configuration for an i/o pin with open-drain 12v capability (standard drive and high drive). figure 32 shows the i/o configuration for an i/o pin with open-drain 5v capability. note : all the port a, b and c i/o lines have schmitt-trig- ger input configuration with a typical hysteresis of 1v. table 10. i/o port options selection (port c) note : x. means don't care. figure 22. i/o configuration diagram (open drain 12v) figure 23. i/o configuration diagram (open drain 5v) ddr dr mode option 0 0 input with on-chip pull-up resistor 0 1 input without on-chip pull-up resistor 1 x output open-drain va00342 i/o n in out i/o high drive, open drain 12v (5ma, 1v) dd v out in n i/o (open-drain, 5v) va00345a open-drain output in input mode only, sw programmable ( 200k ) * * ~
ST6373 34/64 4.1.3 i/o port registers 4.1.3.1 data registers ports a, b, c data register address : c0h (pa), c1h (pb), c2h (pc) - read/write reset value: 00h pa7-pa0 . these are the i/o port a data bits. re- set at power-on. pb7-pb0 . these are the i/o port b data bits. re- set at power-on. pc7-pc0 . these are the i/o port c data bits. set to 04h at power-on. bit 2 (pc2 pin) is set to one (open-drain therefore high impedance). 4.1.3.2 data direction registers ports a, b, c data direction register address : c4h (pa), c5h (pb), c6h (pc) - read/write reset value: 00h pa7-pa0 . these are the i/o port a data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. reset at power-on. pb7-pb0 . these are the i/o port b data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. reset at power-on. pc7-pc0 . these are the i/o port c data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. set to 04h at power-on. bit 2 (pc2 pin) is set to one (output mode select- ed). 4.1.3.3 option registers port a, b, c option register address: cch (pa), cdh (pb) - read/write reset value:00h pa7-pa0. these are the i/o port a option bits. these are set in conjunction with the correspond- ing data and data direction bits to set the individual port a bit i/o mode. pb7-pb0 . these are the i/o port b option bits. these are set in conjunction with the correspond- ing data and data direction bits to set the individual port b bit i/o mode. notes : the wait instruction allows the mcu to be used in situations where low power consumption is required. this can only be achieved, however, if the i/o pins are programmed as inputs with well defined logic levels or have no power consuming resistive loads in output mode. single-bit operations on i/o registers are possible but care is necessary because reading in input mode is from i/o pins while writing will directly af- fect the port data register. 70 pa/pb /pc7 pa/p b /pc6 pa/pb /pc5 pa/pb /pc4 pa/pb /pc3 pa/pb /pc2 pa/pb /pc1 pa/pb /pc0 70 pa/pb /pc7 pa/p b /pc6 pa/pb /pc5 pa/pb /pc4 pa/pb /pc3 pa/pb /pc2 pa/pb /pc1 pa/pb /pc0 70 pa/pb7 pa/pb6 pa/pb5 pa/p b4pa/pb3 pa/pb2 pa/pb1 pa/p b0
ST6373 35/64 4.2 timers the st638x devices offer two on-chip timer pe- ripherals consisting of an 8-bit counter with a 7-bit programmable prescaler, thus giving a maximum count of 2 15 , and a control logic that allows config- uration the peripheral operating mode. figure 1 shows the timer block diagram. the content of the 8-bit counters can be read/written in the tim- er/counter registers tcr that are addressed in the data space as ram locations at addresses d3h (timer 1), dbh (timer 2). the state of the 7- bit prescaler can be read in the psc register at ad- dresses d2h (timer 1) and dah (timer 2). the control logic is managed by tscr registers at d4h (timer 1) and dch (timer 2) addresses as de- scribed in the following paragraphs. the following description applies to all timers. the 8-bit counter is decrement by the output (rising edge) coming from the 7-bit prescaler and can be loaded and read under program control. when it decrements to zero then the tmz (timer zero) bit in the tscr is set to one. if the eti (enable timer in- terrupt) bit in the tscr is also set to one an inter- rupt request, associated to interrupt vector #3 for timer 1 and #1 for timer 2, is generated. the in- terrupt of the timer can be used to exit the mcu from the wait mode. the prescaler decrements on rising edge. the prescaler input is the oscillator frequency divided by 12. depending on the division factor pro- grammed by ps2/ps1/ps0 (see table 1 ) bits in the tscr, the clock input of the timer/counter reg- ister is multiplexed to different sources. on divi- sion factor 1, the clock input of the prescaler is also that of timer/counter; on factor 2, bit 0 of pres- caler register is connected to the clock input of tcr. this bit changes its state with the half frequency of prescaler clock input. on factor 4, bit 1 of psc is connected to clock input of tcr, and so on. on di- vision factor 128, the msb bit 6 of psc is connect- ed to clock input of tcr. the prescaler initialize bit (psi) in the tscr register must be set to one to al- low the prescaler (and hence the counter) to start. if it is cleared to zero then all of the prescaler bits are set to one and the counter is inhibited from counting.the prescaler can be given any value be- tween 0 and 7fh by writing to the related register address, if bit psi in the tscr register is set to one. the tap of the prescaler is selected using the ps2/ps1/ps0 bits in the control register.figure 2 illustrates the timer working principle. figure 24. timer peripheral block diagram databus 8 8 8 8 8-bit counter 6 5 4 3 2 1 0 psc status/control register b7 b6 b5 b4 b3 b2 b1 b0 tmz eti to ut dout psi ps2 ps1 ps0 select 1of8 3 latch synchronization logic timer interrupt line va00009 :1 2 f osc
ST6373 36/64 timers (cont'd) 4.2.1 timer operating modes since in the st638x devices the external timer pin is not connected, the only allowed operating mode is the output mode, which is selected by set- ting bit 4 and by clearing bit 5 in the tscr1 regis- ter. this procedure will enable timer 1 and timer 2. output mode (tscr1 d4 = 1, tscr1 d5 = 0) .on this mode the timer prescaler is clocked by the prescaler clock input (osc/12). the user can se- lect the desired prescaler division ratio through the ps2/ps1/ps0 bits. when tcr count reaches 0, it sets the tmz bit in the tscr. the tmz bit can be tested under program control to perform timer functions whenever it goes high. bits d4 and d5 on tscr2 (timer 2) register are not implemented. timer interrupt when the counter register decrements to zero and the software controlled eti (enable timer interrupt) bit is set to one then an interrupt request associat- ed to interrupt vector #3 (for timer 1), to interrupt vector #1 (for timer 2) is generated. when the counter decrements to zero also the tmz bit in the tscr register is set to one. notes: tmz is set when the counter reaches 00h; howev- er, it may be set by writing 00h in the tcr register or setting the bit 7 of the tscr register. tmz bit must be cleared by user software when servicing the timer interrupt to avoid undesired interrupts when leaving the interrupt service routine. after re- set, the 8-bit counter register is loaded to ffh while the 7-bit prescaler is loaded to 7fh, and the tscr register is cleared which means that timer is stopped (psi=0) and timer interrupt disabled. a write to the tcr register will predominate over the 8-bit counter decrement to 00h function, i.e. if a write and a tcr register decrement to 00h occur simultaneously, the write will take precedence, and the tmz bit is not set until the 8-bit counter reaches 00h again. the values of the tcr and the psc registers can be read accurately at any time. figure 25. timer working principle bit0 bit1 bit2 bit3 bit6 bit5 bit4 clock 7-bit prescaler 8-1 multiplexer 8-bit counter bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 1 0234 5 67 ps0 ps1 ps2 va00186
ST6373 37/64 timers (cont'd) 4.2.2 timer status control registers (tscr) timers 1 and 2 address: d4h (timer 1), dch (timer 2) - read/write reset value: 00h tmz . low-to-high transition indicates that the tim- er count register has decremented to zero. this bit must be cleared by user software before to start with a new count. eti . this bit, when set, enables the timer interrupt (vector #3 for timer 1, vector #2 for timer 2 re- quest). if eti=0 the timer interrupt is disabled. if eti= 1 and tmz= 1 an interrupt request is gener- ated. d5 . this is the timers enable bit d5. it must be cleared to 0 together with a set to 1 of bit d4 to en- able timer 1 and timer 2 functions. it is not imple- mented on registers tscr2. d4 . this is the timers enable bit d4. this bit must be set to 1 together with a clear to 0 of bit d5 to en- able all timers (timer 1 and 2) functions. it is not implemented on registers tscr2. psi . used to initialize the prescaler and inhibit its counting while psi = 0 the prescaler is set to 7fh and the counter is inhibited. when psi = 1 the prescaler is enabled to count downwards. as long as psi= 0 both counter and prescaler are not run- ning. ps2-ps0 . these bits select the division ratio of the prescaler register. (see table 11) the tscr1 and tscr2 registers are cleared on reset. the correct d4-d5 combination must be written in tscr1 by user's software to enable the operation of timer 1 and 2. table 11. prescaler division factors 4.2.3 timer counter registers (tcr) timer counter 1 and 2 address: d3h (timer counter 1), dbh (timer counter 2) - read/write reset value: ffh bit 7-0 = d7-d0 : counter bits. 4.2.4 timer prescaler registers (pscr) timer prescalers 1 and 2 address: d2h (timer prescaler 1), dah (timer prescaler 2) - read/write reset value: 7fh bit 7 = d7 : always read as o0o. bit 6-0 = d6-d0 : prescaler bits. 70 tmz eti d5 d4 psi ps2 ps1 ps0 d5 d4 timers 0 0 disabled 0 1 enabled 1 x reserved ps2 ps1 ps0 divided by 000 1 001 2 010 4 011 8 10016 10132 11064 111128 70 d7 d6 d5 d4 d3 d2 d1 d0 70 d7 d6 d5 d4 d3 d2 d1 d0
ST6373 38/64 4.3 a/d converter (adc) the a/d converter peripheral is an 8-bit analog to digital converter with analog inputs as alternate i/o functions (the number of which is device depend- ent), offering 8-bit resolution with a typical conver- sion time of 70us (at an oscillator clock frequency of 8mhz). the adc converts the input voltage by a process of successive approximations, using a clock fre- quency derived from the oscillator with a division factor of twelve. with an oscillator clock frequency less than 1.2mhz, conversion accuracy is de- creased. selection of the input pin is done by configuring the related i/o line as an analog input via the op- tion and data registers (refer to i/o ports descrip- tion for additional information). only one i/o line must be configured as an analog input at any time. the user must avoid any situation in which more than one i/o pin is selected as an analog input si- multaneously, to avoid device malfunction. the adc uses two registers in the data space: the adc data conversion register, adr, which stores the conversion result, and the adc control regis- ter, adcr, used to program the adc functions. a conversion is started by writing a a1o to the start bit (sta) in the adc control register. this auto- matically clears (resets to a0o) the end of conver- sion bit (eoc). when a conversion is complete, the eoc bit is automatically set to a1o, in order to flag that conversion is complete and that the data in the adc data conversion register is valid. each conversion has to be separately initiated by writing to the sta bit. the sta bit is continuously scanned so that, if the user sets it to a1o while a previous conversion is in progress, a new conversion is started before com- pleting the previous one. the start bit (sta) is a write only bit, any attempt to read it will show a log- ical a0o. the a/d converter features a maskable interrupt associated with the end of conversion. this inter- rupt is associated with interrupt vector #4 and oc- curs when the eoc bit is set (i.e. when a conver- sion is completed). the interrupt is masked using the eai (interrupt mask) bit in the control register. the power consumption of the device can be re- duced by turning off the adc peripheral. this is done by setting the pds bit in the adc control reg- ister to a0o. if pds=a1o, the a/d is powered and en- abled for conversion. this bit must be set at least one instruction before the beginning of the conver- sion to allow stabilisation of the a/d converter. this action is also needed before entering wait mode, since the a/d comparator is not automati- cally disabled in wait mode. during reset, any conversion in progress is stopped, the control register is reset to 40h and the adc interrupt is masked (eai=0). figure 26. adc block diagram 4.3.1 application notes the a/d converter does not feature a sample and hold circuit. the analog voltage to be measured should therefore be stable during the entire con- version cycle. voltage variation should not exceed 1/2 lsb for the optimum conversion accuracy. a low pass filter may be used at the analog input pins to reduce input voltage variation during con- version. when selected as an analog channel, the input pin is internally connected to a capacitor c ad of typi- cally 12pf. for maximum accuracy, this capacitor must be fully charged at the beginning of conver- sion. in the worst case, conversion starts one in- struction (6.5 m s) after the channel has been se- lected. in worst case conditions, the impedance, asi, of the analog voltage source is calculated us- ing the following formula: 6.5 m s=9xc ad xasi (capacitor charged to over 99.9%), i.e. 30 k w in- cluding a 50% guardband. asi can be higher if c ad has been charged for a longer period by adding in- structions before the start of conversion (adding more than 26 cpu cycles is pointless). core control register converter va00418 result register reset interrupt clock av av dd ain 8 core control signals ss 8
ST6373 39/64 a/d converter (cont'd) since the adc is on the same chip as the micro- processor, the user should not switch heavily load- ed output signals during conversion, if high preci- sion is required. such switching will affect the sup- ply voltages used as analog references. the accuracy of the conversion depends on the quality of the power supplies (v dd and v ss ). the user must take special care to ensure a well regu- lated reference voltage is present on the v dd and v ss pins (power supply voltage variations must be less than 5v/ms). this implies, in particular, that a suitable decoupling capacitor is used at the v dd pin. the converter resolution is given by: the input voltage (ain) which is to be converted must be constant for 1 m s before conversion and remain constant during conversion. conversion resolution can be improved if the pow- er supply voltage (v dd ) to the microcontroller is lowered. in order to optimise conversion resolution, the user can configure the microcontroller in wait mode, because this mode minimises noise disturbances and power supply variations due to output switch- ing. nevertheless, the wait instruction should be executed as soon as possible after the beginning of the conversion, because execution of the wait instruction may cause a small variation of the v dd voltage. the negative effect of this variation is min- imized at the beginning of the conversion when the converter is less sensitive, rather than at the end of conversion, when the less significant bits are determined. the best configuration, from an accuracy stand- point, is wait mode with the timer stopped. in- deed, only the adc peripheral and the oscillator are then still working. the mcu must be woken up from wait mode by the adc interrupt at the end of the conversion. it should be noted that waking up the microcontroller could also be done using the timer interrupt, but in this case the timer will be working and the resulting noise could affect conversion accuracy. a/d converter control register (adcr) address: 0d1h e read/write reset value: 40h bit 7 = eai : enable a/d interrupt. if this bit is set to a1o the a/d interrupt (vector #4) is enabled, when eai=0 the interrupt is disabled. bit 6 = eoc : end of conversion. read only . this read only bit indicates when a conversion has been completed. this bit is automatically reset to a0o when the sta bit is written. if the user is using the interrupt option then this bit can be used as an interrupt pending bit. data in the data conversion register are valid only when this bit is set to a1o. bit 5 = sta : start of conversion. write only . writ- ing a a1o to this bit will start a conversion on the se- lected channel and automatically reset to a0o the eoc bit. if the bit is set again when a conversion is in progress, the present conversion is stopped and a new one will take place. this bit is write only, any attempt to read it will show a logical zero. bit 4 = pds : power down selection. this bit acti- vates the a/d converter if set to a1o. writing a a0o to this bit will put the adc in power down mode (idle mode). bit 3-0 = d3-d0. not used a/d converter data register (adr) address: 0d0h e read only reset value: xxh bit 7-0 = d7-d0 : 8 bit a/d conversion result. v dd v ss 256 ---------------------------- 70 eai eoc sta pds d3 d2 d1 d0 70 d7 d6 d5 d4 d3 d2 d1 d0
ST6373 40/64 4.4 sync processor this sync processor is composed of five parts: the first one is a 12 bits event counter with hsync (or hdriv) as input especially design to calculate the hsync (respectively hdriv) fre- quency. the second one is a 12-bits period counter es- pecially designed to calculate the vsync period and therefore his frequency. the third one is a polarity detector for hsync (or hdriv) and vsync. the fourth part is a hsync,vsync and clamp outputs generator. the last part is a video blanking generator. 4.4.1 event counter the counting is directly controlled by the timer 3. when psi bit of timer 3 status control register is low the event counter is in reset mode. at this time the timer 3 counter can be loaded by the count period (for example 10 ms). when psi is set the event counter start simulta- neously with the timer. when the timer count register has decremented to zero the tmz bit is set, an interrupt can be gener- ated (if eti bit is set) and the event counter stops. the result number read inside the event coun- ter registers corresponds to the rising edge number of the event counter clock occurred be- tween the start and the stop. this counter clock is set to one when the counter is in reset ( psi=0) or just stopped (after stop). it is equal to hsync (hdriv) between start and stop. [if there is no hsync (hdriv) the result inside the counter will be: xfffh] example: if the result is 5 the number of rising edges is 6, the number of periods is: 4 < np < 6). calculation: if the timer count is 10 ms the calcula- tion of the hsync frequency could be simple: freq. = n/10 khz where n is the event counter re- sult, the error is + or - one lsb max, it means 100 hz. of course the accuracy can be increased with a higher timing count; 20 ms will give + or - 50 hz. 4.4.2 period counter the vertical period counter is a 12-bits counter with 8 us internal clock which measure by h/w the duration between 2 vsync falling edges. accura- cy is 120+/-0.1 hz. fvmin = 31 hz. one measure- ment start by setting the vacquisition bit (write 1). as this bit is inverted in reading, it is read at 1 after reset. as soon as the operation starts it is read at 0. at the end of the measurement,after the second vsync falling edge, the vacquisition bit is read again at 1. note: if fv < 31 hz, vcount = xfffh = max if no v sync, acq bit is not cleared 4.4.3 polarity detector the vsync polarity detection is always active af- ter reset so the software has only to read the flag (bit 3 of spcr) to determine the polarity. if the po- larity of vsync changes, the flag will switch after a typical delay of 1.5 ms. the vsync polarity can be read continuously. the hsync/hdriv polarity is returned in the flag (bit 2 of spcr). it is always running typically tog- gles after one period of hsync/hdriv when the polarity changes. the same delay has to be considered when switching from hsync to hdriv (bit 0 of spcr). refer to the vsync an hsync input timings. 4.4.4 output polarity control the selection of hsynco instead of pa2 (respec- tively vsynco instead of pa3) is made with the bit 7 (hvos) of spcr. hsynco and vsynco can take two different val- ues according to the bit 6 (hvgen) of spcr: - hsynci (respectively vsynci) - hgen: 62.5 khz / pulse width = 2us (respectively vgen: 61 hz / pulse width: 64 us). the control of the hsynco and vsynco polarity is made with respectively the bit 4 (hopc) and bit 5 (vopc) of spcr. the clamp output signal can be programmed af- ter hsynco rising edge or hsynco falling edge according to the bit 6 (cmct) of ecccr. the clamp output polarity can be selected with bit7 (copc) of ecccr. the pulse width of clmpo can have the values 250 ns, 500 ns or 1 ns according to the bits 5 and 4 (cmw1 and cmw0) of ecccr. remark: when cmw1 = cmw0 = 0 pa4 is select- ed.
ST6373 41/64 sync processor (cont'd) 4.4.5 video blanking generator this block involves hfly, vfly inputs and vsynco as input. the falling edges of hfly (re- spectively vfly) are detected on the flag bit 4 (hflyf) of pcbcr (respectively bit 5 (vflyf)). hfly flag (respectively vfly flag) is reset by soft- ware writing zero. the selection between pa5 and blank output is done with bit 6 (bos) of pcbcr; sync processor control register (spcr) address: dfh - read/write reset value: 00h b7: hvos: h/v sync outputs selection 0=pa2/pa3 as normal port a configuration, 1=hsynco instead of pa2, vsynco instead of pa3, write only, 0 at reset. remark : h/vsynco are forced to push-pull out- puts b6 : hvgen: h/vsync generation. 0= h/vsynco <- h/vsynci or h/vsyncin (accord- ing to h/vopc) 1 = hsynco <- hgen: 62.5khz, pulse: 2 m s (posi- tive polarity); vsynco <- vgen: 61hz, pulse: 64 m s (positive polarity), write only, 0 at reset. b5: vopc: vsync output polarity control 0=vsynco <- vsynci, 1= vsynco <- vsyncin, write only, 0 after reset. b4: hopc: hsync output polarity control 0=hsynco <- hsynci, 1=hsynco<- hsyncin, write only, 0 after reset. b3: vpf: vertical polarity flag 0=positive, 1=negative, read only, 0 after reset. b2: hpf: horizontal polarity flag 0=positive, 1=negative, read only, 0 after reset. b1: vacq: start vsync period acquisition, read/write, 0 after reset (inverted in reading) b0: shh: selection of hsync or hdrive as input 0=hsync, 1=hdrive, write only, 0 after reset. event counter register 1 (ecr1) address: ddh - read-only reset value: ffh b7-b0: 8 lsb bits of counting result, read only, ffh after reset. event counter2 and clamp control register (ecccr) address: deh - read/write reset value: 0fh b7: copc: clamp output polarity control 0=positive - 1=negative write only, 0 after reset b6: cmct: clamp control 0=clmpo after hsynco rising edge, 1=clmpo after hsynco falling edge, write only, 0 after reset. b5-b4: cmw1, cmw0: clamp pulse width remark : clmpo is forced to push-pull outputs. write only, 0 after reset b3-b0: 4 msb bits of event counting result, read only, xfh after reset period counter register 1 (pcr1) address: dfh - read-only reset value: ffh b7-b0: 8 lsb bits of counting result, read only, ffh after reset. 70 hvos hvgen vopc hopc vpf hpf vacq shh 70 h7 h6 h5 h4 h3 h2 h1 h0 70 copc cmct cmw1 cmw0 h11 h10 h9 h8 cmw1 cmw0 clamp pulse width 0 0 normal pa4 0 1 250 ns 1 0 500 ns 1 1 1000 ns 70 v7 v6 v5 v4 v3 v2 v1 v0
ST6373 42/64 sync processor (cont'd) period counter 2 and blank control register (pcbcr) address: f1h - read/write reset value: xfh b7: not used b6: bos: blank output selection 0=pa5, 1=blank, write only, 0 after reset b5: vflyf: vertical fly-back flag set on falling edge of vfly/pb6 input, read and write, cleared by s/w (write of zero), undefined af- ter reset b4: hflyf: horizontal fly-back flag set on falling edge of hfly/pb5 input, read and write, cleared by s/w (write of zero), undefined af- ter reset b3 to b0: 4 msb bits of period counting result, read only, fh after reset figure 27. sync processor block diagram 70 nu bos vfly hfly v11 v10 v9 v8 vsynco 1 0 clmpo hsynco hvgen copc cmct vsynco polarity vsynci hsynci 1 0 hdrive shh to blk v 12 bit timer (vacq) hsynco polarity h 12 bit event counter (timer 3) vsynci hsynci h polarity detector hpf hvgen 1 0 hvos hvos cmw0:1 vsyncen vopc hopc r s blken pa5/blk0 to edge detector (hflyf) to edge detector (vflyf) pb5/hfly pb6/vfly pa3/vsynco hfly, vfly, vsynco signals should have positive polarity blank out generation vr02089a vsync+ generator 61 hz,64 m s hsync+ generator 62.5 khz, 2 m s sync generator h/w block back porch clamp generator clamp polarity latch pulse detect polarity detector vpf
ST6373 43/64 sync processor (cont'd) figure 28. synch processor timing (120hz) (40hz) vr02090a 1024 m s max 32 m s min 8.33ms 25ms 1536 m s min 8.25 m s min 10 m s 33.33 m s (100khz) (30khz) 1.0 m s min 8.125 m s max hsync input timing vsync input timing programmable clamping width (250ns ; 500ns ; 1 m s) maximum delay is 250ns hsynco: clmpo:
ST6373 44/64 4.5 14-bit pwm d/a converter the pwm d/a converter (hda) is composed of a 14-bit counter that allows the conversion of the digital content in an analog voltage, available at the hda output pin, by using pulse width mod- ification (pwm), and bit rate multiplier (brm) techniques. the tuning word consists of a 14-bit word con- tained in the registers hdadata1 (location eeh) and hdadata2 (location efh). coarse tuning (pwm) is performed using the seven msbs, while fine tuning (brm) is performed using the data in the seven lsbits. with all zeros loaded the output is zero; as the tuning voltage increases from all ze- ros, the number of pulses in one period increase to 128 with all pulses being the same width. for val- ues larger than 128, the pwm takes over and the number of pulses in one period remains constant at 128, but the width changes. at the other end of the scale, when almost all ones are loaded, the pulses will start to link together and the number of pulses will decrease. when all ones are loaded, the output will be almost 100% high but will have a low pulse (1/16384 of the high pulse). 4.5.1 output details inside the on-chip d/a converter are included the register latches, a reference counter, pwm and brm control circuitry. in the ST6373 the clock for the 14-bit reference counter is 2mhz derived from the 8mhz system clock. from the circuit point of view, the seven most significant bits control the coarse tuning, while the seven least significant bits control the fine tuning. from the application and software point of view, the 14 bits can be consid- ered as one binary number. as already mentioned the coarse tuning consists of a pwm signal with 128 steps; we can consider the fine tuning to cover 128 coarse tuning cycles. the addition of pulses is described in the following table. the hda output pin has a standard drive push-pull output configuration. table 12. fine tuning pulse addition 4.5.2 hda tuning cell registers hda data register 1 (hdar1) address: eeh - write only reset value: xxh d7-d0 . these are the 8 least significant hda data bits. bit 0 is the lsb. this register is undefined on reset. hda data register 2 (hdar2) address: efh - write only reset value: xxh d7-d6 . these bits are not used. d5-d0 . these are the 6 most significant hda data bits. bit 5 is the msb. this register is undefined on reset. fine tunin g (7 lsb) n of pulses added at the follo wing cycles (0... 127) 0000001 64 0000010 32, 96 0000100 16, 48, 80, 112 0001000 8, 24, ....104, 120 0010000 4, 12, ....116, 124 0100000 2, 6, .... .122, 126 1000000 1, 3, .... .125, 127 70 hda7 hda6 hda5 hda4 hda3 hda2 hda1 hda0 70 - - hda13 hda12 hda11 hda10 hda9 hda8
ST6373 45/64 4.6 7-bit pwm d/a converters the d/a peripheral features nine pwm d/a out- puts (31.25khz repetition, da0-da8) with seven bit resolution. each d/a converter is composed by the following main blocks: - pre-divider - 7-bit counter - data latches and compare circuits the pre-divider uses the clock input frequency (8mhz typical) and its output clocks the 7-bit free- running up-counter. the data latched in the dtoa data/control registers control the nine d/a out- puts (da0,1,2,3,4,6,7 and 8). when the values in the counter and data latch are equal, the relevant output is set. the output is reset on the counter overflow. when a dtoa output is disabled (bit 7 of corresponding control register is low) the output is forced to zero whatever the value of bits 0 to 6. when enabled (bit 7 = 1) the output depends on bits 0 to 6. if all these bits are equal to zero the rel- evant output is an high logic level. all 1's corre- spond to a pulse with a 1/128 duty cycle and al- most 100% zero level. the frequency of the pwm dtoa outputs is 31.25 khz. the duty cycle of the dtoa outputs change in steps of 250ns. the repetition frequency is related to the 8mhz clock frequency. use of a different oscillator fre- quency will result in a different repetition frequen- cy. all d/a outputs are push-pull with standard current drive capability. dtoa channels 0 to 7 are held in a bank of two blocks of four registers selected according to the status of dabs, bit 0 of the d/a bank register at address e7h. dtoa channel 8 is directly ad- dressed at address e4h without the need of the d/a bank register. d/a bank register (dabr) address: e7h - read/write reset value: 00h d7-d1 = not used. dabs . d/a bank selection, this bit is used to se- lect one of the two banks of 4 bytes located at ad- dresses e0h to e3h. read/write, 0 after reset. 0 = select bank 0 1 = select bank 1 bank 0 is used for the da0 to da3 outputs. bank 1 is used for the da4 to da7 outputs. table 13. channel address selection d/a data control registers (ddcr) address: e0h to e3h, e4h - write only reset value: 0xxxxxxxxb enx .enable bit, write only, 0 after reset. 0 = disable channel x 1 = enable channel x daxc6 to daxc0 : data control bits channel x, write only, undefined after reset. 4.6.1 digital outputs the nine 7 bits pwm outputs can also be used as simple outputs. 70 d7 d6 d5 d4 d3 d2 d1 dabs bank select address channel selected 0 e0h da0 0 e1h da1 0 e2h da2 0 e3h da3 1 eoh da4 1 e1h da5 1 e2h da6 1 e3h da7 x e4h da8 70 en daxc6 daxc5 daxc4 daxc3 daxc2 daxc1 daxc0 ddc bit 7 ddcr bits 0 to 6 output state 0 don't care 0 1 all zero 1
ST6373 46/64 4.7 serial peripheral interfaces the ST6373 features two on-chip serial peripher- al interfaces (spis) for synchronous communica- tion with other local control/interface devices. the two spis are similar in basic function, however the first contains additional logic and eeprom mem- ory to manage the vesa ddc data protocol (ddc1, ddc2b and ddc2ab) transmission and reception. both spis can manage standard shift modes (in addition to i 2 c mode), and master/slave i 2 c modes. the serial modes of the spi are summarised in the following table: table 14. spi modes the maximum external clock and vsync clock speed is 25khz. the i 2 c data hold time is 250ns minimum. as the i 2 c spi is derived from the ddc spi, the ddc spi is shown, with the functional differences shown. for the ddc1 and ddc2b an additional 128 bytes of dedicated eeprom can be used to load the spi with predefined data automatically without any cpu time consumption (see block diagram). the address generator contains a 7-bits auto- counter register which allows the cpu to set a eeprom start address from 00h to 7fh. in ddc2b the hardware slave address a0/a1h can be enabled in parallel with the programmed i 2 c slave address. figure 29. ddc spi block diagram slave standard shift mode, with external clock on extclk ddc spi only master standard shift mode with internal clock both spis ddc1 mode with vsync as clock ddc spi only multimaster/slave i 2 c mode both spis vr02034 address sdad generator address data bus address bus 1 0 data ddc eeprom ddc control 0 1 0 1 shift register scld vsync auto buffer
ST6373 47/64 serial peripheral interface (cont'd) 4.7.1 spi modes ddc1 mode . in this mode, the eight bits of the data register are shifted out of the register, most significant bit first, clocked on the rising edge of the vsync input. during the ninth period, the sda line remains high or low depending on the ackc bit. in auto mode (auto=1), the 128 bytes of the ddc eeprom are sent in sequence until the scld input goes low to indicate a ddc acknowl- edgment, an interrupt is generated and the trans- fer is stopped. the data direction is from the mcu, typically as data from the monitor to the host. slave standard shift mode . the operation of this mode is the same as the ddc1 mode except that the clock used is taken from the external clock in- put (extclk on pc3). master standard shift mode . this mode corre- sponds to the standard shift protocol. data in the shift register is shifted out of the sdad line at the internal spi clock speed after the transmission is triggered. the synchronous clock for the data transmission is output on the scld pin. an inter- rupt can be generated at the end of transmission. ddc2 or i 2 c mode. this mode is used in conjunc- tion with software to implement the i 2 c transmis- sion protocol. in master mode, data written into the data register (typically address of the slave and the read/write (r/w) bit for i 2 c-bus) is shifted out when triggered with a preceding start condition. an interrupt can be generated at the end of trans- mission or this can be detected by polling. arbitra- tion is managed by comparing the data on the sdad line with the corresponding data bit of the shift register and an error is flagged if they are dif- ferent. if the addressed slave stretches the low period of the scld line, the master is forced into a wait state.in slave mode, the data register is load- ed with its own slave address, and the ddc spi waits for detection of a start condition. the ad- dress received is compared to that set for the slave, and if the address is correct, an acknowl- edge is sent and an interrupt can be generated, the scld line is held low to allow the software to prepare for the incoming data. if the request in the r/w bit is set (0) the external master wants to write to the slave, if reset, a data value is to be sent. this is managed by the user software. ddc2b mode . the ddc2b mode follows the ddc2 mode until a read command is received. the spi can then be programmed in auto mode to send automatically the 128 bytes of the eep- rom until the end of the communication. i 2 c spi the i 2 c spi manages only the standard shift register mode and the i 2 c-bus mode of the ddc spi. figure 30. ddc1 mode auto not set vr02035 vsync 57 6 14 3 210 89 d7 sda d6 d5 d4 d3 d2 d1 d0 ack start
ST6373 48/64 serial peripheral interface (cont'd) figure 31. i c master transmit to slave receiver (write mode) figure 32. i c master reads slave immediately after first byte (read mode) figure 33. i c master reads after setting slave register address (write address, read data) word address slave address soaa ap acknowledge from slave msb start r/w stop data acknowledge from slave acknowledge from slave slave address s1a a 1p acknowledge from slave msb start r/w stop data acknowledge from master no acknowledge from master msb n bytes data slave address s word address a p acknowledge from slave start r/w stop slave address s1aa 1p acknowledge from slave msb start r/w stop data acknowledge from master no acknowledge from master msb data 0ax acknowledge from slave
ST6373 49/64 serial peripheral interface (cont'd) spi control register 1 (scr1) ddc address: ebh - read/write reset value: 00h i c address: e5h - read/write reset value: 00h ena . spi enable bit.0 - disable spi1 - enable spi write only, 0 after reset.remark: when the spi is disabled, the pins pc0, pc1 and pc3 can be used as normal i/o pins. mss . master/slave selection (mss).0 - se- lect slave operation1 - select master opera- tion enit . enable spi interrupt. the interrupt occurs on a falling edge of sbor. in ddc1 automatic and in ddc2b automatic there is an interrupt only if auto has been reset (refer to bit auto). in i 2 c slave mode the interrupt occurs at the end of the address reception only if this address is matched. 0 = disable spi interrupt 1 = enable spi interrupt ackc . acknowledge control bit (ackc). this bit is used in i 2 c reception to control whether not to send the acknowledge before a restart in master mode, or not to answer if too busy in slave mode.0 = enable1 = disable write only. this bit is also used in ddc1 mode to change the polarity of the acknowledge bit .0 = set acknowledge to high 1 = set acknowledge to low stag . start condition generation for master i 2 c. [i 2 c bus only]0 = no generation1 = gener- ation start condition write only. stog . stop condition generation for master i 2 c. [i 2 c bus only]0 = no generation1 = gener- ation stop condition write only. ms1,ms0 . mode selection (ms1:ms0). ms1 is not used for i 2 cspi note that no bit operation instructions are possi- ble on this register. (set and res) spi control register 2 (scr2) ddc address: ech - read/write reset value: 00h i c address: e6h - read/write reset value: 00h auto . automatic operation mode (auto). this bit is automatically reset :- in ddc1 when scl goes low - in ddc2b when no acknowledge is received or when the data on the sda line is different from the one being sent (for example parasitical stop or start). write only. not used for i 2 cspi intf . interrupt flag (intf). this flag is set when an interrupt occurs if enabled. it must be reset be- fore leaving the interrupt routine. read and reset scdf . start condition detection flag. this flag is set on a start condition detection. it is also set in ddc1 mode on a high to low transition of scl. it must be reset before leaving the interrupt routine. read and reset. bbf . busy bus flag. (i 2 c bus only) set on a first start condition and reset on the stop condition. read and reset. 70 ena mss enit ackc stag stog ms1 ms0 00 ddc1 mode with vsync as clock [ddc spi only] 01 slave standard shift [ddc spi only] 10 master standard shift 11 multimaster/slave i 2 c bus for ddc2 70 auto intf scdf bbf trs vsdaf nadf sbor
ST6373 50/64 serial peripheral interface (cont'd) trs . transmission/reception selection. 0 = select reception operation 1 = select transmission operation write only. this bit is also used in reading as a stop condi- tion detection flag. read only. vsdaf . verification of sda line flag. this bit is set as soon as the data on sda line is different to the data inside ssdr, mainly in transmission but also during the slave address reception when the slave mode is selected. [i 2 c bus only] 0 = no difference detected 1 = difference found on sda read only. nadf . no acknowledge detection flag. [i 2 cbus only] 0 = detection acknowledge 1 = no detection of acknowledge read only. sbor . spi byte operation (transmission or re- ception). this bit is set to start an operation; in i 2 c slave mode it is automatically set when a start condition is detected. 0 = no operation 1 = operation start read and set. note that no bit operation instructions are possi- ble on this register. spi serial data register (ssdr) ddc address: cch - read/write reset value: xxh i c address: cbh - read/write reset value: xxh sd7-sd0 . data bits, r/w, undefined after reset. this serial data register is composed of one buff- er register and one data shift register. when auto = 1, the shift register is linked to the 128 byte ddc eeprom dedicated to ddc1 and ddc2b. the data will then automatically be sent without cpu operation. the 128 bytes ddc eep- rom can be addressed (programmed or read) by the software only when bit auto = 0. software can address the buffer and not the shift register. - the data transfer from the shift register to the buffer is always done at the end of a normal recep- tion (trs = 0) before the reset of sbor. the buff- er should not be read by the software during the data transfer. - with the ddc spi, the loading of the shift regis- ter is done in two different ways depending on the auto bit: when auto = 0 the transfer is done from the buff- er to the shift register on the setting of sbor (or also in i 2 c slave mode, on a start condition de- tection). when auto = 1, the transfer is done from the ddc eeprom to the shift register at the end of each byte transmission. (the first byte is loaded when sbor is set simultaneously with auto) note: when sbor = 1, the loading of the buffer does not affect the shift register. auto-counter register (acr) address: f2h - read/write reset value: 00h b7: not used b6 to b0: 7 bits auto-counter, read/write, 00h af- ter reset. through these 7 bits the ddc1/ddc2b address generator can be set at any eeprom start ad- dress from 00h to 7fh. the content of the counter can be read at any time during the ddc1 or ddc2b automatic mode. 70 sd7 sd6 sd5 sd4 sd3 sd2 sd1 sd0 70 - d6d5d4d3d2 d1d0
ST6373 51/64 serial peripheral interface (cont'd) scl latch and ddc2b address control regis- ter (slacr) address: f3h - read/write reset value: 40h b7 to b4: not used b3: hsae: hardware slave address enable . this bit allows the slave i2c to check, after a start con- dition detection, both the address a0/a1h for ddc2b and the programmed address for the switch to ddc2ab. note that software address contained in ssdr is always valid. 0=disable, 1=enable, write only, 1 after reset b2: sclflag: scl flag bit. this bit is set on scl rising or falling edge according to the polarity bit scledge. this flag can be reset by writing a 1 in sclflag bit (read and reset, undefined after reset). b1: scliten: scl interrupt enable bit .if this bit is set an interrupt on vector # 3 is generated when the scl flag is set (write only, 0 after reset). b0: scledge: scl edge selection bit .the scl input latch is activated on either the positive or negative edge of scl line: if scledge is high the latch will be triggered on the rising edge of scl; if this bit is low the latch will be triggered on the fall- ing edge (write only, 0 after reset). remark: in ddc1, it is not necessary to use the scl latch interrupt because the ddc1 scl falling edge interrupt can be activated (see ddc1 mode). 4.8 mirror register this is an 8-bits register at address d9h. it is cleared on reset. after writing, the read value is the reversed byte: bit0 -> bit7, bit1 -> bit6, bit2 -> bit5, bit3 -> bit4, bit4 -> bit3, bit5 -> bit2, bit6 -> bit1, bit7 -> bit0 4.9 xor register this is a 8-bit register at address f4h. it is cleared on reset. after writing, the new content value is the previous content oxoredo with the written val- ue. to reset this register the user must read its con- tents and rewrite it (a xor a = 0). 70 - - - - hsae scl flag scl iten scl edge
ST6373 52/64 5 software 5.1 st6 architecture the st6 software has been designed to fully use the hardware in the most efficient way possible while keeping byte usage to a minimum; in short, to provide byte efficient programming capability. the st6 core has the ability to set or clear any register or ram location bit of the data space with a single instruction. furthermore, the program may branch to a selected address depending on the status of any bit of the data space. the carry bit is stored with the value of the bit when the set or res instruction is processed. 5.2 addressing modes the st6 core offers nine addressing modes, which are described in the following paragraphs. three different address spaces are available: pro- gram space, data space, and stack space. pro- gram space contains the instructions which are to be executed, plus the data for immediate mode in- structions. data space contains the accumulator, the x,y,v and w registers, peripheral and in- put/output registers, the ram locations and data rom locations (for storage of tables and con- stants). stack space contains six 12-bit ram cells used to stack the return addresses for subroutines and interrupts. immediate . in the immediate addressing mode, the operand of the instruction follows the opcode location. as the operand is a rom byte, the imme- diate addressing mode is used to access con- stants which do not change during program execu- tion (e.g., a constant used to initialize a loop coun- ter). direct . in the direct addressing mode, the address of the byte which is processed by the instruction is stored in the location which follows the opcode. di- rect addressing allows the user to directly address the 256 bytes in data space memory with a single two-byte instruction. short direct . the core can address the four ram registers x,y,v,w (locations 80h, 81h, 82h, 83h) in the short-direct addressing mode. in this case, the instruction is only one byte and the selection of the location to be processed is contained in the op- code. short direct addressing is a subset of the di- rect addressing mode. (note that 80h and 81h are also indirect registers). extended . in the extended addressing mode, the 12-bit address needed to define the instruction is obtained by concatenating the four less significant bits of the opcode with the byte following the op- code. the instructions (jp, call) which use the extended addressing mode are able to branch to any address of the 4k bytes program space. an extended addressing mode instruction is two- byte long. program counter relative . the relative address- ing mode is only used in conditional branch in- structions. the instruction is used to perform a test and, if the condition is true, a branch with a span of -15 to +16 locations around the address of the rel- ative instruction. if the condition is not true, the in- struction which follows the relative instruction is executed. the relative addressing mode instruc- tion is one-byte long. the opcode is obtained in adding the three most significant bits which char- acterize the kind of the test, one bit which deter- mines whether the branch is a forward (when it is 0) or backward (when it is 1) branch and the four less significant bits which give the span of the branch (0h to 0fh) which must be added or sub- tracted to the address of the relative instruction to obtain the address of the branch. bit direct . in the bit direct addressing mode, the bit to be set or cleared is part of the opcode, and the byte following the opcode points to the ad- dress of the byte in which the specified bit must be set or cleared. thus, any bit in the 256 locations of data space memory can be set or cleared. bit test & branch . the bit test and branch ad- dressing mode is a combination of direct address- ing and relative addressing. the bit test and branch instruction is three-byte long. the bit iden- tification and the tested condition are included in the opcode byte. the address of the byte to be tested follows immediately the opcode in the pro- gram space. the third byte is the jump displace- ment, which is in the range of -126 to +129. this displacement can be determined using a label, which is converted by the assembler. indirect . in the indirect addressing mode, the byte processed by the register-indirect instruction is at the address pointed by the content of one of the in- direct registers, x or y (80h,81h). the indirect reg- ister is selected by the bit 4 of the opcode. a regis- ter indirect instruction is one byte long. inherent . in the inherent addressing mode, all the information necessary to execute the instruction is contained in the opcode. these instructions are one byte long.
ST6373 53/64 5.3 instruction set the st6 core offers a set of 40 basic instructions which, when combined with nine addressing modes, yield 244 usable opcodes. they can be di- vided into six different types: load/store, arithme- tic/logic, conditional branch, control instructions, jump/call, and bit manipulation. the following par- agraphs describe the different types. all the instructions belonging to a given type are presented in individual tables. load & store . these instructions use one, two or three bytes in relation with the addressing mode. one operand is the accumulator for load and the other operand is obtained from data memory using one of the addressing modes. for load immediate one operand can be any of the 256 data space bytes while the other is always immediate data. table 15. load & store instructions notes: x,y. indirect register pointers, v & w short direct registers #. immediate data (stored in rom memory) rr. data space register d . affected *. not affected instruction addressing mode bytes cycles flags zc ld a, x short direct 1 4 d * ld a, y short direct 1 4 d * ld a, v short direct 1 4 d * ld a, w short direct 1 4 d * ld x, a short direct 1 4 d * ld y, a short direct 1 4 d * ld v, a short direct 1 4 d * ld w, a short direct 1 4 d * ld a, rr direct 2 4 d * ld rr, a direct 2 4 d * ld a, (x) indirect 1 4 d * ld a, (y) indirect 1 4 d * ld (x), a indirect 1 4 d * ld (y), a indirect 1 4 d * ldi a, #n immediate 2 4 d * ldi rr, #n immediate 3 4 * *
ST6373 54/64 instruction set (cont'd) arithmetic and logic . these instructions are used to perform the arithmetic calculations and logic operations. in and, add, cp, sub instruc- tions one operand is always the accumulator while the other can be either a data space memory con- tent or an immediate value in relation with the ad- dressing mode. in clr, dec, inc instructions the operand can be any of the 256 data space ad- dresses. in com, rlc, sla the operand is always the accumulator. table 16. arithmetic & logic instructions notes: x,y.indirect register pointers, v & w short direct registersd. affected #. immediate data (stored in rom memory)*. not affected rr. data space register instruction addressing mode bytes cycles flags zc add a, (x) indirect 1 4 dd add a, (y) indirect 1 4 dd add a, rr direct 2 4 dd addi a, #n immediate 2 4 dd and a, (x) indirect 1 4 dd and a, (y) indirect 1 4 dd and a, rr direct 2 4 dd andi a, #n immediate 2 4 dd clr a short direct 2 4 dd clr r direct 3 4 * * com a inherent 1 4 dd cp a, (x) indirect 1 4 dd cp a, (y) indirect 1 4 dd cp a, rr direct 2 4 dd cpi a, #n immediate 2 4 dd dec x short direct 1 4 d * dec y short direct 1 4 d * dec v short direct 1 4 d * dec w short direct 1 4 d * dec a direct 2 4 d * dec rr direct 2 4 d * dec (x) indirect 1 4 d * dec (y) indirect 1 4 d * inc x short direct 1 4 d * inc y short direct 1 4 d * inc v short direct 1 4 d * inc w short direct 1 4 d * inc a direct 2 4 d * inc rr direct 2 4 d * inc (x) indirect 1 4 d * inc (y) indirect 1 4 d * rlc a inherent 1 4 dd sla a inherent 2 4 dd sub a, (x) indirect 1 4 dd sub a, (y) indirect 1 4 dd sub a, rr direct 2 4 dd subi a, #n immediate 2 4 dd
ST6373 55/64 instruction set (cont'd) conditional branch . the branch instructions achieve a branch in the program when the select- ed condition is met. bit manipulation instructions . these instruc- tions can handle any bit in data space memory. one group either sets or clears. the other group (see conditional branch) performs the bit test branch operations. control instructions . the control instructions control the mcu operations during program exe- cution. jump and call. these two instructions are used to perform long (12-bit) jumps or subroutines call inside the whole program space. table 17. conditional branch instructions notes : b. 3-bit address rr. data space register e. 5 bit signed displacement in the range -15 to +16 d . affected ee. 8 bit signed displacement in the range -126 to +129 *. not affected table 18. bit manipulation instructions notes: b. 3-bit address; *. not affected rr. data space register; table 19. control instructions notes: 1. this instruction is deactivated and a wait is automatically executed instead of a stop if the watchdog function is selected. d . affected *. not affected table 20. jump & call instructions notes: abc. 12-bit address; *. not affected instruction branch if bytes cycles flags zc jrc e c = 1 1 2 * * jrnc e c = 0 1 2 * * jrz e z = 1 1 2 * * jrnz e z = 0 1 2 * * jrr b, rr, ee bit = 0 3 5 * d jrs b, rr, ee bit = 1 3 5 * d instruction addressing mode bytes cycles flags zc set b,rr bit direct 2 4 * * res b,rr bit direct 2 4 * * instruction addressing mode bytes cycles flags zc nop inherent 1 2 * * ret inherent 1 2 * * reti inherent 1 2 dd stop (1) inherent 1 2 * * wait inherent 1 2 * * instruction addressing mode bytes cycles flags zc call abc extended 2 4 * * jp abc extended 2 4 * *
ST6373 56/64 opcode map summary. the following table contains an opcode map for the instructions used by the st6 abbreviations for addressing modes: legend: dir direct # indicates illegal instructions sd short direct e 5 bit displacement imm immediate b 3 bit address inh inherent rr 1byte dataspace address ext extended nn 1 byte immediate data b.d bit direct abc 12 bit address bt bit test ee 8 bit displacement pcr program counter relative ind indirect low 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 low hi hi 0 0000 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 ld 0 0000 e abc e b0,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 1 0001 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 ldi 1 0001 e abc e b0,rr,ee e x e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 2 0010 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 cp 2 0010 e abc e b4,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 3 0011 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc 4 cpi 3 0011 e abc e b4,rr,ee e a,x e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 4 0100 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 add 4 0100 e abc e b2,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 5 0101 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 addi 5 0101 e abc e b2,rr,ee e y e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 6 0110 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 inc 6 0110 e abc e b6,rr,ee e # e (x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 7 0111 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc 7 0111 e abc e b6,rr,ee e a,y e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 8 1000 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 ld 8 1000 e abc e b1,rr,ee e # e (x),a 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 9 1001 2 rnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 9 1001 e abc e b1,rr,ee e v e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc a 1010 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 and a 1010 e abc e b5,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind b 1011 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc 4 andi b 1011 e abc e b5,rr,ee e a,v e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm c 1100 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 sub c 1100 e abc e b3,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind d 1101 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 subi d 1101 e abc e b3,rr,ee e w e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm e 1110 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 dec e 1110 e abc e b7,rr,ee e # e (x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind f 1111 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc f 1111 e abc e b7,rr,ee e a,w e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc
ST6373 57/64 opcode map summary. (continued) abbreviations for addressing modes: legend: dir direct # indicates illegal instructions sd short direct e 5 bit displacement imm immediate b 3 bit address inh inherent rr 1byte dataspace address ext extended nn 1 byte immediate data b.d bit direct abc 12 bit address bt bit test ee 8 bit displacement pcr program counter relative ind indirect low 8 1000 9 1001 a 1010 b 1011 c 1100 d 1101 e 1110 f 1111 low hi hi 0 0000 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 ldi 2 jrc 4 ld 0 0000 e abc e b0,rr e rr,nn e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 3 imm 1 prc 1 ind 1 0001 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 ld 1 0001 e abc e b0,rr e x e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir 2 0010 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 com 2 jrc 4 cp 2 0010 e abc e b4,rr e a e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 prc 1 ind 3 0011 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 cp 3 0011 e abc e b4,rr e x,a e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir 4 0100 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 reti 2 jrc 4 add 4 0100 e abc e b2,rr e e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind 5 0101 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 add 5 0101 e abc e b2,rr e y e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir 6 0110 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 stop 2 jrc 4 inc 6 0110 e abc e b6,rr e e (y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind 7 0111 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 inc 7 0111 e abc e b6,rr e y,a e rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir 8 1000 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 jrc 4 ld 8 1000 e abc e b1,rr e # e (y),a 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 prc 1 ind 9 1001 2 rnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 ld 9 1001 e abc e b1,rr e v e rr,a 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir a 1010 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 rcl 2 jrc 4 and a 1010 e abc e b5,rr e a e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind b 1011 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 and b 1011 e abc e b5,rr e v,a e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir c 1100 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 ret 2 jrc 4 sub c 1100 e abc e b3,rr e e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind d 1101 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 sub d 1101 e abc e b3,rr e w e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir e 1110 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 wait 2 jrc 4 dec e 1110 e abc e b7,rr e e (y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind f 1111 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 dec f 1111 e abc e b7,rr e w,a e rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir
ST6373 58/64 6 electrical characteristics 6.1 absolute maximum ratings this product contains devices to protect the inputs against damage due to high static voltages, how- ever it is advised to take normal precaution to avoid application of any voltage higher than maxi- mum rated voltages. for proper operation it is recommended that vi and vo must be higher than vss and smaller than vdd. reliability is enhanced if unused inputs are connected to an appropriated logic voltage level (vdd or vss). power considerations .the average chip-junc- tion temperature, tj, in celsius can be obtained from: tj=ta + pd x rthja where :ta = ambient temperature. rthja =package thermal resistance (junc- tion-to ambient). pd = pint + pport. pint =idd x vdd (chip internal power). pport =port power dissipation (determined by the user). note : stresses above those listed as a absolute maximum ratings o may cause permanent damage to the device. this is a stress rating only and functional operation of the device at these conditions is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. thermal characteristics 6.2 recommended operating conditions symbol parameter value unit v dd supply voltage -0.3 to 7.0 v v i input voltage (ad in) vss - 0.3 to + 13 v v i input voltage (other inputs) vss - 0.3 to +13 v v o output voltage (pa4-pa7, pc4-pc7) vss - 0.3 to vdd + 0.3 ) v v o output voltage (other outputs) vss - 0.3 to vdd + 0.3 (1) v i o current drain per pin excluding vdd, vss, pa0-pa7 + 10 ma i o current drain per pin (pa0-pa7) + 20 ma iv dd total current into vdd (source) 50 ma iv ss total current out of vss (sink) 150 ma t j junction temperature 150 c t stg storage temperature -60 to 150 c symbol parameter test conditions value unit min. typ. max. rthja thermal resistance psdip42 67 c/w csdip42 not specified symbol parameter test condition s value unit min. typ. max. t a operating temperature 1 suffix versions 0 70 c v dd operating supply voltage 4.5 5.0 5.5 v f osc oscillator frequency run & wait modes 0.01 8.1 mhz 2 jrc e 1prc mnemonic addressing mode bytes cycle operand
ST6373 59/64 6.3 dc electrical characteristics (ta = 0 to +70 c, v dd = 4.5v unless otherwise specified). table 21: dc electrical characteristics symbol parameter test conditions value unit min. typ. max. v il input low level voltage all i/o pins 0.3xv dd v v ih input high level voltage all i/o pins 0.7xv dd v v hys hysteresis voltage(1) all i/o pins v dd =5v 1.0 v v ol low level output voltage pb0-pb7, pc0-pc7 da0/o0-da8/o8 i ol = 1.6ma i ol = 5ma 0.4 1.0 v v ol low level output voltage pa0-pa7 i ol = 1.6ma i ol = 10ma 0.4 1.0 v v ol low level output voltage oscout i ol = 0.4ma 0.4 v v ol low level output voltage hda output i ol = 0.5ma i ol = 1.6ma 0.4 1.0 v v oh high level output voltage pa0-pa7, pb0-pb7 i oh = 1.6ma 4.1 v v oh high level output voltage oscout, i oh = 0.4ma 4.1 v v oh high level output voltage hda i oh = - 0.5ma 4.1 v i pu input pull up current input mode with pull-up pa0-pa7, pb0-pb7, pc0-pc7, nmi, vsync v in =v ss 100 50 25 m a i pu input pull up current input mode with pull-up reset v in =v ss 50 25 10 m a i il input pull-down current in reset mode oscin 100 m a i il i ih input leakage current oscin v in =v ss v in =v dd 10 0.1 1 1 0.1 10 m a m a i il i ih input leakage current all i/o input mode no pull-up v in =v ss v in =v dd 10 10 10 10 m a m a v dd ram ram retention voltage in reset mode 1.5 v i il i ih input leakage current reset pin with pull-up v in =v ss 50 30 5 m a i oh output leakage current pc0-pc7 v oh =v dd 10 m a i oh output leakage current high voltage pc4-pc7 v oh = 12v 40 m a a di adc input current during conversation v dd = 4.5v 1.0 m a 2 jrc e 1prc mnemonic addressing mode bytes cycle operand
ST6373 60/64 note 1. not 100% tested 6.4 ac electrical characteristics (ta = 0 to +70 c, f osc =8mhz, v dd =4.5 to 5.5v unless otherwise specified) notes: 1. a clock other than 8mhz will affect the frequency response of those peripherals (d/a, and spis) whose clock is derived from the system clock. 2. the rise and fall times of port a have been increased in order to avoid current spikes while maintaining a high drive capability 3. not 100% tested 4. based on extrapolated data i dd supply current run mode f osc = 8mhz, iload= 0ma v dd = 6.0v 616ma i dd supply current wait mode f osc = 8mhz, iload= 0ma v dd =6v 310ma i dd supply current reset, oscillator stopped f osc = not app, iload= 0ma v dd =6v 0.1 1 ma v on reset trigger level on reset pin 0.3xv dd v v off reset trigger level off reset pin 0.8xv dd v v an adc conversion range v ss v dd v symbol parameter test conditio ns value unit min. typ. max. t wres minimum pulse width reset pin 125 ns t ohl high to low transition time all outputs pins v dd = 5v, cl = 100pf (2) 40 ns t olh low to high transition time all outputs pins v dd = 5v, cl = 100pf 40 ns t hd spi data hold time 250 ns f spi spi baud rate 100 khz f dac d/a converter repetition frequency (1) 31.25 khz t wee eeprom write time t a =25 c one byte 5 ms c yee eeprom write/erase cycles q a l ot acceptance criteria 300,000 > 1 million cycles r tee eeprom data retention (4) t a =25 c 10 years c in input capacitance (3) all inputs pins 10 pf c out output capacitance (3) all outputs pins 10 pf c osc oscillator pins internal capacitance (3) 5pf table 21: dc electrical characteristics symbol parameter test conditions value unit min. typ. max.
ST6373 61/64 7 general information 7.1 package mechanical data figure 34. ST6373 and st63t73 42-pin plastic shrink dual-in-line package figure 35. st63e73 42-pin ceramic shrink dual-in-line package dim. mm inches min typ max min typ max a 5.08 0.000 0.000 0.200 a1 0.51 0.000 0.020 0.000 a2 3.05 3.81 4.57 0.150 0.120 0.180 b 0.38 0.46 0.56 0.018 0.015 0.022 b1 0.89 1.02 1.14 0.040 0.035 0.045 c 0.23 0.25 0.38 0.010 0.009 0.015 d 36.58 36.83 37.08 1.450 1.440 1.460 e3 ------ e1 15.24 16.00 0.000 0.600 0.630 e 1.78 0.070 0.000 0.000 ea 15.24 0.600 0.000 0.000 eb 18.54 0.000 0.000 0.730 g 12.70 13.72 14.48 0.540 0.500 0.570 k1 ------ k2 ------ l 2.54 3.30 3.56 0.130 0.100 0.140 number of pins n 42 1 n b d vr01725f n/2 b 1 e a l see lead detail k 1 k 2 e 1 e 3 e b e a g a 2 a 1 dim. mm inches min typ max min typ max a 4.5 0.177 a1 1.27 0.050 b 0.45 0.018 b1 0.89 0.035 c 0.25 0.010 d 37.3 1.470 e 15.49 0.610 e1 14.98 0.590 k -- l 3.2 0.125 e1 1.78 0.070 number of pins n 42
ST6373 62/64 7.2 ordering information the following chapter deals with the procedure for transfer the program/data rom codes to sgs- thomson. communication of the rom codes . to commu- nicate the contents of program/data rom memo- ries to sgs-thomson, the customer must send: one file in intel intellec 8/mds format (either as an eprom or as a ms-dos diskette) for the program memory; one file in intel intellec 8/mds format (either as an eprom or as a ms-dos diskette) for the eeprom initial content (this file is option- al). the program rom should respect the rom mem- ory map as in table 22. the rom code must be generated with an st6 assembler. before programming the eprom, the eprom programmer buffer must be filled with ffh. for shipment to sgs-thomson, the master eproms should be placed in a conductive ic car- rier and packed carefully. customer eeprom initial contents format a the content should be written as an intel in- tellec format file. b in the case of 512 bytes of eeprom, the starting address is 000h and the end address is 1ffh. the order of the pages (64 bytes each) is as shown in the specification. c undefined or don't care bytes should have the content ffh. listing generation & verification . when sgs- thomson receives the codes, a computer listing is generated from them. this listing refers exactly to the mask that will be used to produce the micro- controller. the listing is then returned to the cus- tomer, and it must be thoroughly check, complete, sign and return it to sgs-thomson. the signed list constitutes a part of the contractual agreement for the creation of the customer mask. the sgs- thomson sales organization will be pleased to provide detailed information regarding contractual matters. table 22. rom memory map rom page device address description page 0 0000h-007fh 0080h-07ffh reserved user rom page 1 astatico 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh user rom reserved interrupt vectors reserved nmi vector reset vector page 2 0000h-000fh 0010h-07ffh reserved user rom page 3 0000h-000fh 0010h-07ffh reserved user rom page 4 0000h-000fh 0010h-07ffh reserved user rom page 5 0000h-000fh 0010h-07ffh reserved user rom page 6 0000h-000fh 0010h-07ffh reserved user rom page 7 0000h-000fh 0010h-07ffh reserved user rom 1
ST6373 63/64 ST6373 rom microcontroller option list customer . . . . . . . ............................................. address .................................................... contact .................................................... phoneno .................................................... reference . . . . . . . ............................................. device [ ] ST6373j2 [ ] ST6373j3 [ ] ST6373j5 8k rom 12k rom 16k rom 192 ram 192 ram 192 ram 512 eeprom 512 eeprom 512 eeprom special marking [ ] no [ ] yes a________________o (authorized characters are letters, digits, ' . ', ' - ', ' / ' and spaces only) maximum character count is 16 characters default marking is sales type (part number) mask option: i2c clock speed [ ] 100khz (default) [ ] 400khz all options must be defined before acceptance signature . . . . . . . ............................................. date ....................................................
ST6373 64/64 table 23. ordering information table note : a xxx o is the rom code identifier that is allocated by sgs-thoms on after receipt of all required options and the related rom file. information furnished is believed to be accurate and reliable. however, sgs-thom son microelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of sgs-thoms on microelectronics. specifications mentioned in this publication are subject to change without notice. this publication supersedes and replaces all information previously supplied.sgs-thomson microelectronics products are not authorized for use as critical components in life support devices or systems without the express written approval of sgs-th omson microelectronics. 1998 sgs-thoms on microelectronics - all rights reserved. purchase of i2c components by sgs-tho mson microelectronics conveys a license under the philips i2c patent. rights to use these components in an i2c system is granted provided that the system conforms to the i2c standard specification as defined by philips. sgs-thomson microelectronics group of companies australia - brazil - canada - france - germany - italy - japan - korea - malaysia - malta - morocco - the netherlands - singapor e spain - sweden - switzerland - taiwan - thailand - united kingdom - u.s.a. sales type program memory eeprom ddc dac temp. range package emulating devices 14 bit 7 bit ST6373j2b1/xxx 8k rom 512 bytes yes 1 9 0 to +70 c psdip42 st63e73j5d1, st63t73j5b1 ST6373j3b1/xxx 12k rom ST6373j5b1/xxx 16k rom st63t73j5b1 16k otp - st63e73j5d1 16k eprom 25 c csdip42


▲Up To Search▲   

 
Price & Availability of ST6373

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X